Simulating long-range coherence of atoms and photons in quantum computers