subroutine gen_excit_back_spawn_ueg_new(nI, ilutI, nJ, ilutJ, exFlag, ic, &
ExcitMat, tParity, pgen, HelGen, store, part_type)
integer, intent(in) :: nI(nel), exFlag
integer(n_int), intent(in) :: ilutI(0:niftot)
integer, intent(out) :: nJ(nel), ic, ExcitMat(2, maxExcit)
integer(n_int), intent(out) :: ilutJ(0:niftot)
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, intent(in), optional :: part_type
character(*), parameter :: this_routine = "gen_excit_back_spawn_ueg_new"
integer :: iUnused
#ifdef DEBUG_
real(dp) :: pgen2
HElement_t(dp) :: temp_hel
#endif
HelGen = 0.0_dp
iUnused = exFlag
iUnused = store%nopen
ic = 2
! do i want to implement both old and new back spawn??
! no!
if ((t_back_spawn_flex .or. t_back_spawn) .and. &
(.not. test_flag(ilutI, get_initiator_flag(part_type)))) then
call gen_double_back_spawn_ueg_new(nI, ilutI, part_type, nJ, ilutJ, tParity, &
ExcitMat, pgen)
#ifdef DEBUG_
if (.not. IsNullDet(nJ)) then
pgen2 = calc_pgen_back_spawn_ueg_new(nI, ilutI, ExcitMat, ic, part_type)
if (abs(pgen - pgen2) > 1.0e-6_dp) then
if (tHPHF) then
print *, "due to circular dependence, no matrix element calc possible!"
temp_hel = 0.0_dp
else
temp_hel = get_helement(nI, nJ, ilutI, ilutJ)
end if
write(stdout, *) 'Calculated and actual pgens differ. for non-initiator'
write(stdout, *) 'This will break HPHF calculations'
write(stdout, *) 'reference det: '
call write_det(stdout, projedet(:, part_type_to_run(part_type)), .true.)
call write_det(stdout, nI, .false.)
write(stdout, '(" --> ")', advance='no')
call write_det(stdout, nJ, .true.)
write(stdout, *) 'Excitation matrix: ', ExcitMat(1, 1:ic), '-->', &
ExcitMat(2, 1:ic)
write(stdout, *) 'Generated pGen: ', pgen
write(stdout, *) 'Calculated pGen: ', pgen2
write(stdout, *) 'matrix element: ', temp_hel
call stop_all(this_routine, "Invalid pGen")
end if
end if
#endif
else
call gen_double_ueg(nI, ilutI, nJ, ilutJ, tParity, ExcitMat, pgen)
#ifdef DEBUG_
if (.not. IsNullDet(nJ)) then
pgen2 = calc_pgen_ueg(ilutI, ExcitMat, ic)
if (abs(pgen - pgen2) > 1.0e-6_dp) then
if (tHPHF) then
print *, "due to circular dependence, no matrix element calc possible!"
! temp_hel = hphf_off_diag_helement(nI,nJ,ilutI,ilutJ)
temp_hel = 0.0_dp
else
temp_hel = get_helement(nI, nJ, ilutI, ilutJ)
end if
write(stdout, *) 'Calculated and actual pgens differ. for non-initiator'
write(stdout, *) 'This will break HPHF calculations'
call write_det(stdout, nI, .false.)
write(stdout, '(" --> ")', advance='no')
call write_det(stdout, nJ, .true.)
write(stdout, *) 'Excitation matrix: ', ExcitMat(1, 1:ic), '-->', &
ExcitMat(2, 1:ic)
write(stdout, *) 'Generated pGen: ', pgen
write(stdout, *) 'Calculated pGen: ', pgen2
write(stdout, *) 'matrix element: ', temp_hel
call stop_all(this_routine, "Invalid pGen")
end if
end if
#endif
end if
end subroutine gen_excit_back_spawn_ueg_new