First-principles calculations of stable local structures and electronic structures of magnesium secondary battery cathode materials, MgCo2−xMnxO4 (x = 0, 0.5), in second charged state after first discharge