# get_helement_excit Function

## public function get_helement_excit(nI, nJ, IC, ExcitMat, tParity) result(hel)

### Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
integer, intent(in) :: nJ(nel)
integer, intent(in) :: IC
integer, intent(in) :: ExcitMat(2,ic)
logical, intent(in) :: tParity

## Source Code

    function get_helement_excit(NI, NJ, IC, ExcitMat, TParity) result(hel)

! Calculate the Hamiltonian Matrix Element for a given determinant (or
! csf), when we have the excitation matrix and parity of the
! excitation.
!
! In:  nI, nJ       - The determinants to evaluate
!      IC           - The number of orbitals I,J differ by
!      ex           - The excitation matrix
!      tParity      - The parity of the excitation
! Ret: hel          - The H matrix element

integer, intent(in) :: nI(nel), nJ(nel), IC
integer, intent(in) :: ExcitMat(2, ic)
logical, intent(in) :: tParity
HElement_t(dp) :: hel

character(*), parameter :: this_routine = 'get_helement_excit'

! intermediately put the special call to the hubbard matrix elements
! here. Although I want to change that in the whole code to have
! procedure pointers similar to the excitation generator, which gets
! intialized to the correct function at the beginning of the
! excitations
! store all the lattice model matrix elements in one call.
if (t_lattice_model) then
hel = get_helement_lattice(nI, ic, ExcitMat, tParity)
return
end if

! GUGA implementation:
if (tGUGA) then
if (all(nI == nJ)) then
hel = calcDiagMatEleGUGA_nI(nI)
return
end if

end if

if (IC < 0) then
call stop_all(this_routine, "get_helement_excit should only be &
&used if we know the number of excitations and the &
&excitation matrix")
end if

hel = dyn_sltcnd_excit_old(nI, IC, ExcitMat, tParity)

if (IC == 0) then
hel = hel + (ECore)
else if (tStoquastize) then
hel = -abs(hel)
end if

end function get_helement_excit