site_constructor Function

private function site_constructor(ind, n_neighbors, neighbors, k_vec, r_vec, site_type) result(this)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ind
integer, intent(in) :: n_neighbors
integer, intent(in) :: neighbors(n_neighbors)
integer, intent(in), optional :: k_vec(3)
integer, intent(in), optional :: r_vec(3)
character(len=*), intent(in), optional :: site_type

Return Value type(site)


Contents

Source Code


Source Code

    function site_constructor(ind, n_neighbors, neighbors, k_vec, r_vec, site_type) &
        result(this)
        ! similar to the lattice constructor i want to have a site
        ! constructor, which depending on some input constructs the
        ! specific sites on a lattice
        ! for now the index is the only necessary input..
        ! include more in this site constructor here
        integer, intent(in) :: ind
        integer, intent(in) :: n_neighbors
        integer, intent(in) :: neighbors(n_neighbors)
        integer, intent(in), optional :: k_vec(3)
        integer, intent(in), optional :: r_vec(3)
        character(*), intent(in), optional :: site_type
        ! i think i have to use pointers again..
        ! but maybe this is really bad to deal with in the rest of the code..
        type(site) :: this
        character(*), parameter :: this_routine = "site_constructor"

        if (present(site_type)) then
            ! not yet implementetd or to do.. so wait..
            select case (site_type)

            case ('impurity', 'imp')

                call this%set_impurity(.true.)

            case ('bath')

                call this%set_bath(.true.)

            case default
                call stop_all(this_routine, &
                              "incorrect site type provided")

            end select

        else
            ! this is the default case

        end if

        if (present(k_vec)) then
            if (present(r_vec)) then
                call this%initialize(ind, n_neighbors, neighbors, k_vec, r_vec)
            else
                call this%initialize(ind, n_neighbors, neighbors, k_vec)
            end if
        else
            ASSERT(.not. present(r_vec))
            call this%initialize(ind, n_neighbors, neighbors)
        end if

    end function site_constructor