Magnesium, calcium and energy