subroutine init_symmetry_states()
! routine to initialize the to be analysed states of the
! wavefunction
integer :: i, n_states
integer(n_int) :: ilut(0:niftot)
integer(n_int), allocatable :: largest_walkers(:, :)
real(dp) :: temp_sign(lenof_sign)
if (t_read_symmetry_states) then
! if we read them in, we have to find it in the walker-list
! but only in the 1000 most populated states
n_states = 1000
do i = 1, n_symmetry_states
call EncodeBitDet(symmetry_states(:, i), symmetry_states_ilut(:, i))
end do
else if (t_pop_symmetry_states) then
! here we have to take the N most occupied from the
! wavefunction
! otherwise just find the N most populated states
n_states = n_symmetry_states
end if
allocate(largest_walkers(0:niftot, n_states))
largest_walkers = 0_n_int
call get_highest_pop(n_states, largest_walkers)
if (t_read_symmetry_states) then
call find_states_in_list(n_symmetry_states, symmetry_states, &
largest_walkers, symmetry_weights)
else if (t_pop_symmetry_states) then
symmetry_states_ilut = largest_walkers(:, 1:n_symmetry_states)
do i = 1, n_symmetry_states
call decode_bit_det(symmetry_states(:, i), largest_walkers(:, i))
call extract_sign(largest_walkers(:, i), temp_sign)
symmetry_weights(i) = temp_sign(1)
end do
end if
end Subroutine init_symmetry_states