CheckforBrillouins Subroutine

public subroutine CheckforBrillouins()

Arguments

None

Contents

Source Code


Source Code

    SUBROUTINE CheckforBrillouins()
        INTEGER :: i, j
        LOGICAL :: tSpinPair

!Standard cases.
        IF ((tHub .and. tReal) .or. (tRotatedOrbs) .or. ((LMS /= 0) .and. (.not. tUHF)) .or. tReltvy) THEN
!Open shell, restricted.
            tNoBrillouin = .true.
        ELSE
!Closed shell restricted, or open shell unrestricted are o.k.
            tNoBrillouin = .false.
            tUseBrillouin = .true.
        end if

!Special case of complex orbitals.
        IF (tFixLz .and. (.not. tNoBrillouin)) THEN
            write(stdout, *) "Turning Brillouins theorem off since we are using non-canonical complex orbitals"
            tNoBrillouin = .true.
        end if

        ! Special case of defining a det with LMS=0, but which is open shell.
        ! No Brillouins if it's a restricted HF calc.
        tSpinPair = .false.
        IF (tDefineDet .and. (LMS == 0) .and. (.not. tUHF)) THEN
            ! If we are defining our own reference determinant, we want to
            ! find out if it is open shell or closed to know whether or not
            ! brillouins theorem holds.
            !
            ! If LMS/=0, then it is easy and must be open shell, otherwise
            ! we need to consider the occupied orbitals.
            do i = 1, (NEl - 1), 2
                ! Assuming things will probably go alpha beta alpha beta,
                ! run through each alpha and see if there's a corresponding
                ! beta.
                tSpinPair = .false.
                IF (MOD(BRR(FDet(i)), 2) /= 0) THEN
!Odd energy, alpha orbital.
                    IF (BRR(FDet(i + 1)) /= (BRR(FDet(i)) + 1)) THEN
                        ! Check the next orbital to see if it's the beta (will
                        ! be alpha+1 when ordered by energy). If not, check
                        ! the other orbitals for the beta, as it's possible
                        ! the orbitals are ordered weird (?).
                        do j = 1, NEl
                            IF (BRR(FDet(j)) == (BRR(FDet(i)) + 1)) tSpinPair = .true.
                        end do
                    ELSE
                        tSpinPair = .true.
                    end if
                ELSE
!Even energy, beta orbital. The corresponding alpha will be beta-1.
                    IF (BRR(FDet(i + 1)) /= (BRR(FDet(i)) - 1)) THEN
                        do j = 1, NEl
                            IF (BRR(FDet(j)) == (BRR(FDet(i)) - 1)) tSpinPair = .true.
                        end do
                    ELSE
                        tSpinPair = .true.
                    end if
                end if
                IF (.not. tSpinPair) EXIT
            end do
            IF (.not. tSpinPair) THEN
!Open shell LMS=0 determinant.
!If restricted HF orbitals are being used, brillouins theorem does not hold.
                tNoBrillouin = .true.
                tUseBrillouin = .false.
                write(stdout, '(A)') " Using an open shell reference determinant in a basis of restricted HF orbitals; " &
                & //"Brillouins theorem is being turned off. "
            end if
        end if

    ENDSUBROUTINE CheckforBrillouins