Quantum dynamics simulation of photons and molecules