1. Introduction Magnesium secondary batteries are expected to be applied as a next generation battery materials having higher volume energy density than lithium ion batteries. In our laboratory, we are conducting research and development on cathode materials for magnesium secondary batteries. In recent years, the spinel MgCo2O4 and MgCo1.5Mn0.5O4 in which part of Co is substituted with Mn have been synthesized and measured the battery characteristics of average structure1). From this previous study, it became clear that the Mg/Co cation mixing become decreasing and the first discharge capacity became increasing with the substitution of Mn atom. The first-principle calculation was also performed for the spinel MgCo2O4 and MgCo1.5Mn0.5O4 in pristine and discharge process and reported that the structure changed from a spinel structure to a rock salt structure during discharge2). From the first-principle calculation, it was found that the structure change of MgCo1.5Mn0.5O4 was remarkable because the bond between Mg and O was weakened especially by the influence of Mn. In our laboratory, we have also reported that spinel type Mg(MgxVyNiz)O4 with mixed valence vanadium ions as a host structure has better cycle characteristics than MgCo2O4 system3). However, the local structure in the charge / discharge process and the structural change when Mg is inserted have not been elucidated. The purpose of this study is to investigate the stable structure of Mg(MgxVyNiz)O4 at pristine and discharge process by using the first-principles calculation, and to clarify the mechanism of Mg insertion.2. Calculation method The stable structure of the spinel Mg(Mg0.31V1.69)O4 and Mg(Mg0.31V1.56Ni0.13)O4 inserted Mg atoms (shown as Mg1+y(Mg0.31V1.69)O4 and Mg1+y(Mg0.31V1.56Ni0.13)O4 (y = 0.125~0.75); y is equal to the amount of Mg atoms), were obtained by GGA+U method (VASP code) in discharge process. The cell size of the spinel Mg(Mg0.31V1.69)O4 and Mg(Mg0.31V1.56Ni0.13)O4 were (2×1×1).3. Results and discussion The stable structures of the spinel Mg(Mg0.31V1.69)O4 and Mg(Mg0.31V1.56Ni0.13)O4 at pristine obtained by the first-principle calculation are shown in Fig. 1. In previous study, it was reported that the 8a site was occupied by only Mg atom, and the 16d site was occupied by V, Mg and Ni atom from the average structure analysis measured by the synchrotron X-ray diffraction.3) Models are created based on the results of Rietveld analysis in this study. In both Fig. a-1) and b-1), Mg at 16d site tends to coordinate relatively close to each other in the crystal. It is found from b-1) that Ni also tends to coordinate to positions close to each other. Fig. 1.a-2) and b-2) show the stable structure at the discharge with y=0.25 of Mg inserted into the vacancy 16c site the spinel Mg(Mg0.31V1.69)O4 and Mg(Mg0.31V1.56Ni0.13)O4 at pristine, respectively. Green circles in Fig. 1 a-2) and b-2) are indicated the Mg inserted into the hole 16c site. The Mg before the structural relaxation is indicated by a black dotted circle, and the Mg moved after the structural relaxation is indicated by an arrow and a red circle in in Fig. 1 a-2) and b-2), respectively. As shown in Fig. a-2) and b-2), the structure of Mg become stable when it is inserted into the 16c site near Mg, which is mixed to the 16d site. The model in which the inserted Mg coordinated away from each other in the crystal has high total energy. In both a-2) and b-2), it is found that the Mg atoms at the 8a site near the inserted Mg have moved to the 16c site. When Mg are inserted into spinel Mg(Mg0.31V1.69)O4 and Mg(Mg0.31V1.56Ni0.13)O4, it becomes clear that the structural change to rocksalt is occurred around Mg at 16d site. This structural change during discharge is also observed in the spinel type MgCo2-xMnxO4 system. Since the distance between the nearest 8a site and 16c site is about 1.7 to 1.8 Å, it is considered that repulsion between cations occurs. On the lecture, we will show the electron density and discuss the electronic state in detail. Acknowledgement This work was partly supported by ALCA-SPRING Grant Number JPMJAL1301, Japan. We are deeply grateful for the cooperation.1) Y. Idemoto, Y. Mizutani, C. Ishibashi, N. Ishida and N. Kitamura, Electrochemistry 87, 220 (2019).2) C. Ishibashi, Y. Mizutani, N. Ishida, N. Kitamura, Y. Idemoto, Bull. Chem. Soc. Jpn. 92, 1950 (2019).3) Y. Idemoto, N. Kawakami, N. Ishida, N. Kitamura, Electrochemistry 87, 281 (2019). Figure 1