subroutine init_generate_connected_space(nI, ex_flag, tAllExcitFound, excit, excit_gen, nstore, tTempUseBrill)
use SymExcit2, only: gensymexcitit2par_worker
integer, intent(in) :: nI(nel)
integer, intent(out) :: ex_flag
logical, intent(out) :: tAllExcitFound
integer, intent(out) :: excit(2, 2)
integer, allocatable, intent(out) :: excit_gen(:)
integer, intent(out) :: nStore(6)
logical, intent(out) :: tTempUseBrill
integer :: iMaxExcit, nExcitMemLen(1), nJ(nel), ierr
character(*), parameter :: t_r = 'init_generate_connected_space'
! Which excitations levels should be considered?
! Singles only (1), doubles only (2) or singles and doubles (3).
if (tHub) then
if (tReal) then
ex_flag = 1
else
ex_flag = 2
end if
else if (tUEG) then
ex_flag = 2
else
ex_flag = 3
end if
tAllExcitFound = .false.
if (tKPntSym) then
! We have to ensure that brillouins theorem isn't on for the
! excitation generator.
if (tUseBrillouin) then
tTempUseBrill = .true.
tUseBrillouin = .false.
else
tTempUseBrill = .false.
end if
iMaxExcit = 0
nStore = 0
call GenSymExcitIt2Par_worker(nI, nel, G1, nBasis, .true., nExcitMemLen, nJ, &
iMaxExcit, nStore, ex_flag, 1, nel)
allocate(excit_gen(nExcitMemLen(1)), stat=ierr)
if (ierr /= 0) call stop_all(t_r, "Problem allocating excitation generator.")
excit_gen = 0
call GenSymExcitIt2Par_worker(nI, nel, G1, nBasis, .true., excit_gen, nJ, &
iMaxExcit, nStore, ex_flag, 1, nel)
else
excit = 0
end if
end subroutine init_generate_connected_space