Preparation or purification of gas mixtures for ammonia synthesis