subroutine compare_states(n_states, orig_states, trans_states)
! compare the original and the symmetry transformed states
integer, intent(in) :: n_states
integer(n_int), intent(in) :: orig_states(0:niftot, n_states), &
trans_states(0:niftot, n_states)
integer(n_int) :: null_int(0:niftot), ilutI(0:niftot), ilutJ(0:niftot)
integer :: i, j, k, l
! print the original and the transformed states next to each other
! and missing determinants in the repective lists are indicated
i = 1
j = 1
null_int = 0_n_int
! or first create a list and an integer indicator, where the
! determinant is from..
do k = 1, 2 * n_states
ilutI = orig_states(:, i)
ilutJ = trans_states(:, j)
if (DetBitEq(ilutI, ilutJ)) then
! if both are equal we can move on
call print_2_states(ilutI, ilutJ)
i = i + 1
j = j + 1
else if (ilut_lt(ilutI, ilutJ)) then
! if I is less than J, we have to increase I and only print I
call print_2_states(ilutI, null_int)
i = i + 1
else
! if J is smaller we have to print J and increase J
call print_2_states(null_int, ilutJ)
j = j + 1
end if
! and provide the correct exci conditions
if (i == j .and. i > n_states) exit
if (i > n_states .and. j <= n_states) then
! if i is already above the list then the rest of the
! entries are from list J
do l = j, n_states
ilutJ = trans_states(:, l)
call print_2_states(null_int, ilutJ)
end do
exit
end if
! and if j is alreay above, then the rest is from I
if (i <= n_states .and. j > n_states) then
do l = i, n_states
ilutI = orig_states(:, l)
call print_2_states(ilutI, null_int)
end do
exit
end if
end do
end subroutine compare_states