Electronic structures and structural phase transition mechanism of Sr2MgWO6 from first-principles calculations