calcB_vector_nI Function

public pure function calcB_vector_nI(nI) result(bVector)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nEl)

Return Value real(kind=dp), (nEl)


Contents

Source Code


Source Code

    pure function calcB_vector_nI(nI) result(bVector)
        ! function to calculate the bVector from a CSF given in nI
        ! representation. Gives b vector also of length nEl.
        ! not yet quite sure if i should output b as integers or real
        integer, intent(in) :: nI(nEl)
        real(dp) :: bVector(nEl), bValue

        integer :: iOrb, inc

        ! init
        iOrb = 1
        bVector = 0.0_dp
        bValue = 0.0_dp
        inc = 0

        do while (iOrb <= nEl)
            if (isDouble(nI, iOrb)) then
                bVector(iOrb) = bValue
                bVector(iOrb + 1) = bValue
                inc = 2

            else
                inc = 1
                if is_alpha(nI(iOrb)) then
                bValue = bValue - 1.0_dp

            else
                bValue = bValue + 1.0_dp

            end if
            bVector(iOrb) = bValue

            end if

            iOrb = iOrb + inc

        end do

    end function calcB_vector_nI