read_lattice_struct Subroutine

private subroutine read_lattice_struct(this)

Arguments

Type IntentOptional Attributes Name
class(ext_input) :: this

Contents

Source Code


Source Code

    subroutine read_lattice_struct(this)

        class(ext_input):: this

        integer :: x1,y1, x2,y2

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

        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 ('DIM')
                call this%set_ndim(to_int(tokens%next()))

            case ('LATTICE_TYPE')
                this%name = to_upper(tokens%next())

            case ('LATTICE_PARAM')
                x1 = to_int(tokens%next())
                y1 = to_int(tokens%next())
                x2 = to_int(tokens%next())
                y2 = to_int(tokens%next())

                this%lat_vec(1:2, 1) = [x1, y1]
                this%lat_vec(1:2, 2) = [x2, y2]

            case ('N_CONNECT_MAX')
                this%n_connect_max = to_int(tokens%next())
            end select
        end do lat

        call this%set_length(1, 3)

        call file_reader%close()

    end subroutine read_lattice_struct