Predicting impurity gases and phases during hydrogen evolution from complex metal hydrides using free energy minimization enabled by first-principles calculations.