Returns indices from channel_indices_ that match the specified quantum state.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int32), | intent(in) | :: | v_ |
vibrational quantum number |
||
integer(kind=int32), | intent(in) | :: | j_ |
rotational quantum number |
||
integer(kind=int32), | intent(in) | :: | channel_indices_(:) |
holds the indices pointing to the basis arrays |
(output) indices that match the specified quantum state
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=int32), | private | :: | index_ | ||||
integer(kind=int32), | private | :: | match_count_ | ||||
integer(kind=int32), | private | :: | number_of_channels_ |
function get_block_indices(v_, j_, channel_indices_) result(block_indices_)
!! Returns indices from channel_indices_ that match the specified quantum state.
integer(int32), intent(in) :: v_
!! vibrational quantum number
integer(int32), intent(in) :: j_
!! rotational quantum number
integer(int32), intent(in) :: channel_indices_(:)
!! holds the indices pointing to the basis arrays
integer(int32), allocatable :: block_indices_(:)
!! (output) indices that match the specified quantum state
!---------------------------------------------------------------------!
integer(int32) :: number_of_channels_, match_count_, index_
!---------------------------------------------------------------------!
number_of_channels_ = size(channel_indices_)
match_count_ = 0
!---------------------------------------------------------------------!
! Count the number of matches to preallocate the array
!---------------------------------------------------------------------!
do index_ = 1, number_of_channels_
if (vib_levels(channel_indices_(index_)) == v_ .and. &
rot_levels(channel_indices_(index_)) == j_) then
match_count_ = match_count_ + 1
endif
enddo
!---------------------------------------------------------------------!
! Allocate array with the correct size
!---------------------------------------------------------------------!
allocate(block_indices_(match_count_))
match_count_ = 0
!---------------------------------------------------------------------!
! Fill the array with matching indices.
!---------------------------------------------------------------------!
do index_ = 1, number_of_channels_
if (vib_levels(channel_indices_(index_)) == v_ .and. &
rot_levels(channel_indices_(index_)) == j_) then
match_count_ = match_count_ + 1
block_indices_(match_count_) = index_
endif
enddo
!---------------------------------------------------------------------!
end function get_block_indices