CalcOccEnergies Subroutine

public subroutine CalcOccEnergies(OccEnergies)

Arguments

Type IntentOptional Attributes Name
real(kind=dp) :: OccEnergies(1:NoRotOrbs)

Contents

Source Code


Source Code

    subroutine CalcOccEnergies(OccEnergies)

        use RotateOrbsData, only: NoRotOrbs

        real(dp) :: OccEnergies(1:NoRotOrbs)
        integer :: i, a, b, NoOcc, x, Prev, k

        OccEnergies(:) = 0.0_dp
        if (tStoreSpinOrbs) then
            do x = 1, 2
                if (x == 1) then
                    NoOcc = nOccBeta
                    Prev = 0
                    k = 1
                else
                    NoOcc = nOccAlpha
                    Prev = SpatOrbs
                    k = 2
                end if
                do i = 1 + Prev, NoOcc + Prev
                    ! We are only interested in the diagonal elements.
                    do a = 1, NoOrbs
                        b = SymLabelList2_rot(a)
                        OccEnergies(k) = OccEnergies(k) + (NatOrbMat(a, i) * ARR(b, 2) * NatOrbMat(a, i))
                    end do
                    k = k + 2
                end do
            end do
        else
            NoOcc = NEl / 2
            do i = 1, NoOcc
                ! We are only interested in the diagonal elements.
                do a = 1, NoOrbs
                    b = SymLabelList2_rot(a)
                    OccEnergies(i) = OccEnergies(i) + (NatOrbMat(a, i) * ARR(2 * b, 2) * NatOrbMat(a, i))
                end do
            end do
        end if

    end subroutine CalcOccEnergies