Temperature dependent structure formation and photoluminescence studies of a series of magnesium-based coordination networks