read_lattice_n_sites Function

private function read_lattice_n_sites(this, length_x, length_y, length_z) result(n_sites)

Type Bound

ext_input

Arguments

Type IntentOptional Attributes Name
class(ext_input) :: this
integer, intent(in) :: length_x
integer, intent(in) :: length_y
integer, intent(in), optional :: length_z

Return Value integer


Contents

Source Code


Source Code

    function read_lattice_n_sites(this, length_x, length_y, length_z) result(n_sites)

        class(ext_input):: this

        integer, intent(in) :: length_x, length_y
        integer, intent(in), optional :: length_z
        integer :: n_sites


        CHARACTER(LEN=100) w
        type(ManagingFileReader_t) :: file_reader
        type(TokenIterator_t) :: tokens

        unused_var(this)
        unused_var(length_x)
        unused_var(length_y)

        if (present(length_z)) then
            unused_var(length_z)
        end if

        file_reader = ManagingFileReader_t("lattice.file")

        lat: do while (file_reader%nextline(tokens, skip_empty=.true.))
            w = to_upper(tokens%next())
            select case (w)
            case ('N_SITES')
                n_sites = to_int(tokens%next())
            end select
        end do lat

        call file_reader%close()
    end function read_lattice_n_sites