subroutine store_hf_coeff(e_values, e_vecs, target_state, hf_coeff, hf_ind, gs_ind)
real(dp), intent(in) :: e_values(:), e_vecs(:,:)
integer, intent(in), optional :: target_state
real(dp), intent(out) :: hf_coeff
integer, intent(out) :: hf_ind, gs_ind
real(dp) :: gs_vec(size(e_values))
integer :: target_state_
def_default(target_state_,target_state,1)
gs_ind = my_minloc(e_values, target_state)
gs_vec = abs(e_vecs(:,gs_ind))
hf_ind = maxloc(gs_vec,1)
hf_coeff = gs_vec(hf_ind)
end subroutine store_hf_coeff