CalcOpenOrbs Subroutine

public pure subroutine CalcOpenOrbs(ilut, OpenOrbs)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:NIfD)
integer, intent(out) :: OpenOrbs

Contents

Source Code


Source Code

    pure SUBROUTINE CalcOpenOrbs(iLut, OpenOrbs)
        INTEGER(kind=n_int) :: iLutAlpha(0:NIfD), iLutBeta(0:NIfD)
        integer(n_int), intent(in) :: ilut(0:NIfD)
        integer, intent(out) :: OpenOrbs

        iLutAlpha(:) = 0
        iLutBeta(:) = 0

        iLutAlpha(:) = IAND(iLut(:), MaskAlpha)    !Seperate the alpha and beta bit strings
        iLutBeta(:) = IAND(iLut(:), MaskBeta)
        iLutAlpha(:) = ISHFT(iLutAlpha(:), -1)     !Shift all alpha bits to the left by one.

        iLutAlpha(:) = NOT(iLutAlpha(:))              ! This NOT means that set bits are now represented by 0s, not 1s
        iLutAlpha(:) = IAND(iLutAlpha(:), iLutBeta(:)) ! Now, only the 1s in the beta string will be counted.

        OpenOrbs = CountBits(iLutAlpha, NIfD, NEl)
    END SUBROUTINE CalcOpenOrbs