generate_space_from_file Subroutine

public subroutine generate_space_from_file(filename, ilut_list, space_size)


Type IntentOptional Attributes Name
character(len=255), intent(in) :: filename
integer(kind=n_int), intent(inout) :: ilut_list(0:,:)
integer, intent(inout) :: space_size


Source Code

    subroutine generate_space_from_file(filename, ilut_list, space_size)

        ! In: filename - Name of file to read for determinants.
        ! In/Out: ilut_list - List of determinants generated.
        ! In/Out: space_size - Number of determinants in the generated space.
        !             If ilut_list is not empty on input and you want to keep
        !             the states already in it, then on input space_size should
        !             be equal to the number of states to be kept in ilut_list,
        !             and new states will be added in from space_size+1.
        !             Otherwise, space_size must equal 0 on input.
        !             On output space_size will equal the total number of
        !             generated plus what space_size was on input.

        character(255), intent(in) :: filename
        integer(n_int), intent(inout) :: ilut_list(0:, :)
        integer, intent(inout) :: space_size

        integer :: iunit, stat
        integer(n_int) :: ilut(0:NIfTot), ilut_tmp(0:NIfTot)
        logical :: does_exist

        inquire (file=trim(filename), exist=does_exist)
        if (.not. does_exist) call stop_all("generate_space_from_file", &
                                            "No "//trim(filename)//" file detected.")

        iunit = get_free_unit()
        open(iunit, file=trim(filename), status='old')

        ilut = 0_n_int
        ilut_tmp = 0_n_int

            read(iunit, *, iostat=stat) ilut(0:nifd)

            ! If the end of the file.
            if (stat < 0) exit

            ! If this determinant isn't the correct determinant for the time
            ! reversal symmetry, then try the spin-flipped version.
            if (tHPHF) then
                if (.not. IsAllowedHPHF(ilut(0:NIfD))) then
                    call spin_sym_ilut(ilut(0:NIfD), ilut_tmp(0:NIfD))
                    if (.not. IsAllowedHPHF(ilut_tmp(0:NIfD))) then
                        ilut(0:NIfD) = ilut_tmp(0:NIfD)
                    end if
                end if
            end if

            call add_state_to_space(ilut, ilut_list, space_size)
        end do


    end subroutine generate_space_from_file