deterministic_annihilation Subroutine

public subroutine deterministic_annihilation(iter_data)

Arguments

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

Contents


Source Code

    subroutine deterministic_annihilation(iter_data)

        type(fcimc_iter_data), intent(inout) :: iter_data
        integer :: i, j, run, pt
        real(dp), dimension(lenof_sign) :: SpawnedSign, CurrentSign, SignProd

        ! Copy across the weights from partial_determ_vecs (the result of the deterministic projection)
        ! to CurrentDets:
        do run = 1, size(cs_replicas)

            associate(rep => cs_replicas(run))

                do i = 1, rep%determ_sizes(iProcIndex)
                    call extract_sign(CurrentDets(:, rep%indices_of_determ_states(i)), CurrentSign)
                    ! Update the sign of this replica only
                    SpawnedSign = 0.0_dp
                    SpawnedSign(rep%min_part():rep%max_part()) = rep%partial_determ_vecs(:, i)
                    do pt = rep%min_part(), rep%max_part()
                        call encode_part_sign(CurrentDets(:, rep%indices_of_determ_states(i)), SpawnedSign(pt) + CurrentSign(pt), pt)
                    end do

                    ! Update stats:
                    ! Number born:
                    iter_data%nborn = iter_data%nborn + abs(SpawnedSign)
                    ! Number annihilated:
                    SignProd = CurrentSign * SpawnedSign
                    do j = 1, lenof_sign
                        if (SignProd(j) < 0.0_dp) iter_data%nannihil(j) = iter_data%nannihil(j) + &
                                                                          2 * (min(abs(CurrentSign(j)), abs(SpawnedSign(j))))
                    end do
                end do
            end associate
        end do
    end subroutine deterministic_annihilation