# GenExcitations3 Subroutine

## public subroutine GenExcitations3(nI, iLut, nJ, exflag, ExcitMat3, tParity, tAllExcitFound, ti_lt_a_only)

### Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(NEl)
integer(kind=n_int), intent(in) :: iLut(0:NIfTot)
integer, intent(out) :: nJ(NEl)
integer, intent(inout) :: exflag
integer, intent(inout) :: ExcitMat3(2,2)
logical, intent(out) :: tParity
logical, intent(out) :: tAllExcitFound
logical, intent(in) :: ti_lt_a_only

## Source Code

    SUBROUTINE GenExcitations3(nI, iLut, nJ, exflag, ExcitMat3, tParity, tAllExcitFound, ti_lt_a_only)
! This routine finds in turn, every possible excitation from determinant nI.
! The excited determinant is then returned as nJ.
! exflag indicates which excitations we want to find.  exflag=1 - only singles are returned, exflag=2 - only
! doubles are returned and anything else returns the singles followed by the doubles.
! ExcitMat3 holds the orbitals involved in the excitation.
! If an excitation matrix of 0's is passed through, the first single or double is found.
! After this, the routine reads in the ExcitMat and finds the next excitation after this.
! ExcitMat(1,*) are the orbitals in the determinant to vacate from nI (the i,j pair)
! ExcitMat(2,*) are the orbitals to occupy in nJ (the a,b pair) (not the index, but the actual orbital)
! If tParity is true, two orbitals need to be switched in order to better represent the excitation, therefore a
! negative sign must be included when finding the H element.
! When there are no more symmetry allowed excitations, tAllExcitFound becomes true.
INTEGER(KIND=n_int), intent(in) :: iLut(0:NIfTot)
INTEGER, intent(in) :: nI(NEl)
integer, intent(out) :: nJ(NEl)
integer, intent(inout) :: ExcitMat3(2, 2), exflag
LOGICAL, intent(out) :: tAllExcitFound, tParity
LOGICAL, intent(in) :: ti_lt_a_only

tAllExcitFound = .false.

IF (exflag == 2) THEN
! Just generate doubles
CALL GenDoubleExcit(nI, iLut, nJ, ExcitMat3, tParity, tAllExcitFound, ti_lt_a_only)

ELSE
! Generate singles, returning Orbi and Orba as non-zero, but keeping the others 0.
CALL GenSingleExcit(nI, iLut, nJ, exflag, ExcitMat3, tParity, tAllExcitFound, ti_lt_a_only)

! When the last single is input, providing exflag is not 1, the first double is then found
! and from then on GenDoubleExcit is called.

end if

ENDSUBROUTINE GenExcitations3