rm_non_inits_from_spawnedparts Subroutine

public subroutine rm_non_inits_from_spawnedparts(ValidSpawned, iter_data)


Type IntentOptional Attributes Name
integer, intent(inout) :: ValidSpawned
type(fcimc_iter_data), intent(inout) :: iter_data


Source Code

    subroutine rm_non_inits_from_spawnedparts(ValidSpawned, iter_data)

        ! Overwrite (and therefore remove) any determinants in SpawnedParts
        ! which are not initiators. When using the pure-initiator-space
        ! option, any walkers which will survive already have their initiator
        ! flag set. So those that do not can be removed now.

        integer, intent(inout) :: ValidSpawned
        integer :: i, length_new
        type(fcimc_iter_data), intent(inout) :: iter_data

        real(dp) :: spawned_sign(lenof_sign)

        length_new = 0

        do i = 1, ValidSpawned
            if (any_run_is_initiator(SpawnedParts(:, i))) then
                length_new = length_new + 1
                SpawnedParts(:, length_new) = SpawnedParts(:, i)
                call extract_sign(SpawnedParts(:, i), spawned_sign)
                iter_data%naborted = iter_data%naborted + abs(spawned_sign)
            end if
        end do

        ValidSpawned = length_new

        !write(stdout,*) "SpawnedParts final:"
        !do i = 1, ValidSpawned
        !    if (SpawnedParts(0,i) == SpawnedParts(0,i+1)) write(stdout,*) "ERROR!"
        !    call extract_sign (SpawnedParts(:, i), spawned_sign)
        !    write(stdout,'(i7, 4x, i16, 4x, f18.7, 4x, l1)') i, SpawnedParts(0,i), spawned_sign, &
        !        test_flag(SpawnedParts(:,i), get_initiator_flag(1))
        !end do

    end subroutine rm_non_inits_from_spawnedparts