create_sym_pool Subroutine

public subroutine create_sym_pool(nI, tgt, ms, pool, nPicked, tgt_sym, cc_unocc)

create a pool of unoccupied orbitals with a given symmetry @param[in] nI determinant to excite from @param[in] tgt array of size 3, contains the already picked target orbitals @param[in] ms spin of the pool. ms>0 is alpha, ms<0 beta @param[out] pool on return, a list of the available orbitals to excite to @param[in] nPicked number of already picked target orbitals @param[in] tgt_sym symmetry of the pool @param[in] cc_unocc array containing the number of unoccupied orbitals per irrep

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
integer, intent(in) :: tgt_sym
integer, intent(in) :: cc_unocc(ScratchSize)

Contents

Source Code


Source Code

    subroutine create_sym_pool(nI, tgt, ms, pool, nPicked, tgt_sym, cc_unocc)
        integer, intent(inout) :: tgt(3)
        integer, intent(in) :: ms, nI(nel), nPicked
        integer, allocatable, intent(out) :: pool(:)
        integer, intent(in) :: tgt_sym
        integer, intent(in) :: cc_unocc(ScratchSize)

        integer :: i, pool_size, k, cc_ind, spin_ind

        if (ms > 0) then
            spin_ind = 1
        else
            spin_ind = 2
        end if
        ! get the number of possible orbitals
        cc_ind = ClassCountInd(spin_ind, tgt_sym, 0)
        pool_size = cc_unocc(cc_ind)

        ! we need to see how many same spin orbs have been picked so far
        do i = 1, nPicked
            if ((sign(1, ms) == G1(tgt(i))%Ms) .and. &
                G1(tgt(i))%Sym%S == tgt_sym) 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)) .and. (G1(i)%Sym%S == tgt_sym)) 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_sym_pool', 'size mismatch')
        end if
    end subroutine create_sym_pool