Electronic origins of the giant volume collapse in the pyrite mineral MnS2