create_full_pool Subroutine

public subroutine create_full_pool(nI, tgt, ms, pool, nPicked)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
integer, intent(inout) :: tgt(3)
integer, intent(in) :: ms
integer, intent(out), allocatable :: pool(:)
integer, intent(in) :: nPicked

Contents

Source Code


Source Code

    subroutine create_full_pool(nI, tgt, ms, pool, nPicked)
        integer, intent(inout) :: tgt(3)
        integer, intent(in) :: ms, nI(nel), nPicked
        integer, allocatable, intent(out) :: pool(:)

        integer :: i, pool_size, k

        ! get the number of possible orbitals
        if (ms > 0) then
            pool_size = nUnoccAlpha
        else
            pool_size = nUnoccBeta
        end if

        ! we need to see how many same spin orbs have been picked so far
        do i = 1, nPicked
            if ((ms > 0) .neqv. is_beta(tgt(i))) pool_size = pool_size - 1
        end do

        allocate(pool(pool_size))

        k = 0

        do i = 1, nBasis
            ! Check if this has the right spin
            if (ms > 0 .neqv. is_beta(i)) then
                ! Check if the orb is both unocc and
                if (all(tgt(1:nPicked) /= i) .and. all(nI /= i)) then
                    k = k + 1
                    pool(k) = i
                end if
            end if
        end do

        if (k /= pool_size) then
            write(stdout, *) "Error: wrong number of targets", k, "/=", pool_size
            call stop_all('create_full_pool', 'size mismatch')
        end if
    end subroutine create_full_pool