add_state_to_space Subroutine

public subroutine add_state_to_space(ilut, ilut_list, space_size, nI_in)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:NIfTot)
integer(kind=n_int), intent(inout) :: ilut_list(0:,:)
integer, intent(inout) :: space_size
integer, intent(in), optional :: nI_in(nel)

Contents

Source Code


Source Code

    subroutine add_state_to_space(ilut, ilut_list, space_size, nI_in)

        ! This subroutine, takes a state, decides if it lives on this processor and,
        ! if so, adds it to ilut_list. It also adds one to the space size on this proc.

        ! In: ilut - The determinant in a bitstring form.
        ! In/Out: ilut_list - List of determinants to which ilut will be added.
        ! In/Out: space_size - The number of determinants belonging to this process.
        ! In (optional): nI_in - A list of the occupied orbitals in the determinant.

        integer(n_int), intent(in) :: ilut(0:NIfTot)
        integer(n_int), intent(inout) :: ilut_list(0:, :)
        integer, intent(inout) :: space_size
        integer, optional, intent(in) :: nI_in(nel)

        integer :: nI(nel)
        integer :: proc

        ! If using HPHFs then only allow the correct HPHFs to be added to the list.
        if (tHPHF) then
            if (.not. IsAllowedHPHF(ilut(0:NIfD))) return
        end if

        ! Find the nI representation of determinant.
        if (present(nI_in)) then
            nI = nI_in
        else
            call decode_bit_det(nI, ilut)
        end if

        proc = DetermineDetNode(nel, nI, 0)

        if (.not. (proc == iProcIndex)) return

        space_size = space_size + 1
        ilut_list(0:, space_size) = 0_n_int
        ilut_list(0:NIfTot, space_size) = ilut(0:NIfTot)

    end subroutine add_state_to_space