subroutine set_deterministic_flag(i)
use FciMCData, only: HashIndex, core_run
use bit_rep_data, only: flag_deterministic
use hash, only: hash_table_lookup
use bit_reps, only: set_flag
use core_space_util, only: cs_replicas
implicit none
integer, intent(in) :: i
integer :: nI(nel), DetHash, PartInd
logical :: tSuccess
character(*), parameter :: this_routine = "set_deterministic_flag"
! For each core-state, we check if it is in the CurrentDets (which should
! always be the case in the initialization
associate(rep => cs_replicas(core_run))
call decode_bit_det(nI, rep%core_space(:, i))
call hash_table_lookup(nI, rep%core_space(:, i), nifd, HashIndex, CurrentDets, PartInd, &
DetHash, tSuccess)
if (tSuccess) then
! And then we set the deterministic flag
call set_flag(CurrentDets(:, PartInd), flag_deterministic(core_run))
else
call stop_all(this_routine, "Deterministic state not present in CurrentDets")
end if
end associate
end subroutine set_deterministic_flag