Crystal structures and vibrational properties of chalcogenides: the role of temperature and pressure