gen_guga_tJ_cum_list Subroutine

private subroutine gen_guga_tJ_cum_list(csf_i, id, cum_arr, tgt, tgt_pgen)

Arguments

Type IntentOptional Attributes Name
type(CSF_Info_t), intent(in) :: csf_i
integer, intent(in) :: id
real(kind=dp), intent(out), allocatable :: cum_arr(:)
integer, intent(in), optional :: tgt
real(kind=dp), intent(out), optional :: tgt_pgen

Contents

Source Code


Source Code

    subroutine gen_guga_tJ_cum_list(csf_i, id, cum_arr, tgt, tgt_pgen)
        type(CSF_Info_t), intent(in) :: csf_i
        integer, intent(in) :: id
        real(dp), allocatable, intent(out) :: cum_arr(:)
        integer, intent(in), optional :: tgt
        real(dp), intent(out), optional :: tgt_pgen

        integer, allocatable :: neighbors(:)
        integer :: i, n
        real(dp) :: cum_sum, tmp

        neighbors = lat%get_neighbors(id)

        allocate(cum_arr(size(neighbors)), source=0.0_dp)

        cum_sum = 0.0_dp
        tmp = 0.0_dp

        if (present(tgt)) then
            tgt_pgen = 0.0_dp

            do i = 1, size(neighbors)

                n = neighbors(i)

                if (csf_i%stepvector(n) == 0) then
                    tmp = 1.0_dp
                    cum_sum = cum_sum + tmp
                    if (tgt == n) tgt_pgen = tmp
                end if
            end do
        else
            do i = 1, size(neighbors)
                n = neighbors(i)

                if (csf_i%stepvector(n) == 0) then
                    cum_sum = cum_sum + 1.0_dp
                end if

                cum_arr(i) = cum_sum
            end do
        end if

    end subroutine gen_guga_tJ_cum_list