subroutine generate_triple_excit(nI, ilutI, nJ, ilutJ, ExcitMat, tParity, pGen, &
HelGen, store)
integer, intent(in) :: nI(nel)
integer(n_int), intent(in) :: ilutI(0:NIfTot)
integer, intent(out) :: nJ(nel), ExcitMat(2, maxExcit)
logical, intent(out) :: tParity
real(dp), intent(out) :: pGen
HElement_t(dp), intent(out) :: HElGen
type(excit_gen_store_type), intent(inout), target :: store
integer(n_int), intent(out) :: ilutJ(0:NIfTot)
integer :: sym_prod, src(3), tgt(3), elecs(3)
integer :: ms
unused_var(store)
HElGen = 0.0_dp
! first, pick three electrons at random
call pick_three_elecs(nI, elecs, src, sym_prod, pgen, ms)
! if three electrons can be picked
if (src(3) /= 0) then
! get three unoccupied orbitals with the same ms
if (t_ueg_3_body) then
call pick_three_orbs_ueg(nI, src, tgt, pgen, ms)
else if (tNoSymGenRandExcits) then
! picking three orbs regardless of symmetry is easier
call pick_three_orbs_nosym(nI, tgt, pgen, ms)
else
call pick_three_orbs_sym(nI, src, tgt, pgen, ms)
end if
if (tgt(3) == 0) then
! the excitation is invalid
nJ = 0
ilutJ = 0_n_int
ExcitMat = 0
tParity = .false.
return
end if
! and create a triple excitation
call make_triple(nI, nJ, elecs, tgt, ExcitMat, tParity)
ilutJ = make_ilutJ(ilutI, ExcitMat, 3)
else
! else, the excitation is invalid
nJ = 0
ilutJ = 0_n_int
ExcitMat = 0
tParity = .false.
end if
end subroutine generate_triple_excit