TestClosedShellDet Function

public pure function TestClosedShellDet(iLut) result(tClosed)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: iLut(0:NIfTot)

Return Value logical


Contents

Source Code


Source Code

    pure function TestClosedShellDet(ilut) result(tClosed)

        ! Is the determinant closed shell?

        integer(n_int), intent(in) :: iLut(0:NIfTot)
        integer(n_int) :: alpha(0:NIfD), beta(0:NIfD)
        logical :: tClosed

        ! Separate alphas and betas
        alpha = iand(ilut(0:NIfD), MaskAlpha)
        beta = iand(ilut(0:NIfD), MaskBeta)

        ! Shift and XOR to eliminate paired electrons
        alpha = ieor(beta, ishft(alpha, -1))

        ! Are there any remaining unpaired electrons?
        tClosed = all(alpha == 0)

    end function TestClosedShellDet