create_diagonal_as_spawn Subroutine

public subroutine create_diagonal_as_spawn(ilut, diag_sign, iter_data)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:niftot)
real(kind=dp), intent(in) :: diag_sign(lenof_sign)
type(fcimc_iter_data), intent(inout) :: iter_data

Contents


Source Code

    subroutine create_diagonal_as_spawn(ilut, diag_sign, iter_data)
        ! new routine to create diagonal particles into new DiagParts
        ! array to distinguish between spawns and diagonal events in the
        ! combination y(n) + k2
        use Parallel_neci, only: iProcIndex
        integer(n_int), intent(in) :: ilut(0:niftot)
        real(dp), intent(in) :: diag_sign(lenof_sign)
        type(fcimc_iter_data), intent(inout) :: iter_data
        character(*), parameter :: this_routine = "create_diagonal_as_spawn"

        logical :: list_full
        integer, parameter :: flags = 0

        unused_var(iter_data)

        ! Note that this is a diagonal event, no communication is needed

        ! Check that the position described by valid_diag_spawn_list is acceptable.
        ! If we have filled up the memory that would be acceptable, then
        ! kill the calculation hard (i.e. stop_all) with a descriptive
        ! error message.
        list_full = .false.
        if (valid_diag_spawns > MaxWalkersPart) list_full = .true.
        if (list_full) then
            print *, "Attempting to spawn particle onto processor: ", iProcIndex
            print *, "No memory slots available for this spawn."
            print *, "Please increase MEMORYFACSPAWN"
            print *, "VALID DIAG SPAWN LIST", valid_diag_spawns
            print *, "NUMBER OF OCC DETERMINANTS", TotWalkers
            call stop_all(this_routine, "Out of memory for spawned particles")
        end if

        call encode_bit_rep(DiagParts(:, valid_diag_spawns), ilut, &
                            diag_sign, flags)

        if (tFillingStochRDMonFly) then
            call stop_all(this_routine, "RDM not yet implemented in the rt-fciqmc!")
            ! We are spawning from ilutI to
            ! SpawnedParts(:,valid_diag_spawn_list(proc)). We want to store the
            ! parent (D_i) with the spawned child (D_j) so that we can add in
            ! Ci.Cj to the RDM later.
            ! The parent is nifd integers long, and stored in the second
            ! part of the SpawnedParts array from NIfTot+1 --> NIfTot+1+nifd

        end if

        valid_diag_spawns = valid_diag_spawns + 1

    end subroutine create_diagonal_as_spawn