We present a numerical method which accurately computes the discrete spectrum
and associated bound states of Hamiltonians which model electronic "edge"
states localized at boundaries of one and two-dimensional crystalline
materials. The problem is non-trivial since arbitrarily large finite "hard"
truncations of the Hamiltonian in the infinite bulk direction tend to produce
spurious bound states partially supported at the truncation. Our method, which
overcomes this difficulty, is to compute the Green's function of the
Hamiltonian by imposing an appropriate boundary condition in the bulk
direction; then, the spectral data is recovered via Riesz projection. We
demonstrate our method's effectiveness by studies of edge states at a graphene
zig-zag edge in the presence of defects modeled both by a discrete
tight-binding model and a continuum PDE model under finite difference
discretization. Our method may also be used to study states localized at domain
wall-type edges in one and two-dimensional materials where the edge Hamiltonian
is infinite in both directions; we demonstrate this for the case of a
tight-binding model of distinct honeycomb structures joined along a zig-zag