FindDetSpinSym Subroutine

public pure subroutine FindDetSpinSym(nI, nJ, NEl)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(NEl)
integer, intent(out) :: nJ(NEl)
integer, intent(in) :: NEl

Contents

Source Code


Source Code

    PURE SUBROUTINE FindDetSpinSym(nI, nJ, NEl)
        INTEGER, intent(in) :: NEl, nI(NEl)
        integer, intent(out) :: nJ(NEl)
        integer :: i


        ! for debug compilation treat first entry seperately
        if (is_alpha(nI(1))) then
            nJ(1) = nI(1) - 1
        else
            if (get_alpha(nI(1)) /= nI(2)) then
                nJ(1) = nI(1) + 1
            else
                nJ(1) = nI(1)
            end if
        end if

        do i = 2, nel
            ! If electron is an alpha electron, change it to a beta (unless
            ! it is part of a closed pair of electrons).
            if(is_alpha(nI(i))) then
                if(i == 1) then
                    nJ(i) = nI(i) - 1
                else if(get_beta(nI(i)) /= nI(i - 1)) then
                    nJ(i) = nI(i) - 1
                else
                    nJ(i) = nI(i)
                end if
                ! vice-versa for beta.
            else
                if(i == nel) then
                    nJ(i) = nI(i) + 1
                else if(get_alpha(nI(i)) /= nI(i + 1)) then
                    nJ(i) = nI(i) + 1
                else
                    nJ(i) = nI(i)
                end if
            end if
        end do

    END SUBROUTINE FindDetSpinSym