Based on the density functional theory with hybrid functional approach,we calculated the structural,electronic,and the optical properties of Cu2MgSn(S1-xSex)4 (CMTSSe),an potential photovoltaic material for thin film solar cells.The calculation reveals a phase transition from kesterite to stannite structure when Zn atoms are substituted by Mg atoms.In particular,the S-to-Se ratio can determine the energy splitting between the electronic states at the top of the valence band.The band gaps of CMTSSe can be tuned in the ranges of 1.01-1.58 eV.Calculated optical properties and tunable band gaps make them beneficial for achieving band-gap-graded solar cells.