Viharas were for the purpose of living, Chaityas were assemblies for the purpose of discussions. Further, Chaityas were with Stupas, Viharas did not have stupas.
The Capital of Magadh empire was situates at Rajgriha or Girivraja. The city was almost impregnable as it was surrounded by five hills, the openings in which were closed by stone walls on all sides.