SetupValidSpawned Subroutine

public subroutine SetupValidSpawned(WalkerListSize)



Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: WalkerListSize


Source Code

Source Code

    subroutine SetupValidSpawned(WalkerListSize)

        use CalcData, only: MemoryFacSpawn

        implicit none
        integer(int64), intent(in) :: WalkerListSize
        integer ierr, j
        real(dp) Gap

        !When running normally, WalkerListSize will be equal to totalwalkers
        !However, when reading in (and not continuing to grow) it should be equal to the number of dets in the popsfile
        MaxSpawned = NINT(MemoryFacSpawn * WalkerListSize * inum_runs)
!            write(stdout,"(A,I14)") "Memory allocated for a maximum particle number per node for spawning of: ",MaxSpawned

!      write(stdout,"(A)") "*Direct Annihilation* in use...Explicit load-balancing disabled."
        allocate(ValidSpawnedList(0:nNodes - 1), stat=ierr)
        ! InitialSpawnedSlots is now filled later, once the number of particles
        ! wanted is known
        !(it can change according to the POPSFILE).
        allocate(InitialSpawnedSlots(0:nNodes - 1), stat=ierr)
        ! InitialSpawnedSlots now holds the first free position in the
        ! newly-spawned list for each processor, so it does not need to be
        ! reevaluated each iteration.
!      MaxSpawned=NINT(MemoryFacSpawn*InitWalkers)
        Gap = REAL(MaxSpawned, dp) / REAL(nNodes, dp)
        do j = 0, nNodes - 1
            InitialSpawnedSlots(j) = NINT(Gap * j) + 1
        end do
        ! ValidSpawndList now holds the next free position in the newly-spawned
        ! list, but for each processor.
        ValidSpawnedList(:) = InitialSpawnedSlots(:)

    end subroutine SetupValidSpawned