  We present a platform for the simulation of quantum magnetism with full
control of interactions between pairs of spins at arbitrary distances in one-
and two-dimensional lattices. In our scheme, two internal atomic states
represent a pseudo-spin for atoms trapped within a photonic crystal waveguide
(PCW). With the atomic transition frequency aligned inside a band gap of the
PCW, virtual photons mediate coherent spin-spin interactions between lattice
sites. To obtain full control of interaction coefficients at arbitrary
atom-atom separations, ground-state energy shifts are introduced as a function
of distance across the PCW. In conjunction with auxiliary pump fields,
spin-exchange versus atom-atom separation can be engineered with arbitrary
magnitude and phase, and arranged to introduce non-trivial Berry phases in the
spin lattice, thus opening new avenues for realizing novel topological spin
models. We illustrate the broad applicability of our scheme by explicit
construction for several well known spin models.
