Structure and thermodynamic studies of the LaMgNi4 compound and its hydrides by density functional theory