Hydrogen storage of Mg1−xMxH2 (M = Ti, V, Fe) studied using first-principles calculations