Na4MgFe(PO4)3 crystallizes in the trigonal R3c space group. There are two inequivalent Na sites. In the first Na site, Na(1) is bonded in a 6-coordinate geometry to one O(1), one O(2), two equivalent O(3), and two equivalent O(4) atoms. In the second Na site, Na(2) is bonded in a distorted hexagonal planar geometry to three equivalent O(3) and three equivalent O(4) atoms. Mg(1) is bonded to three equivalent O(1) and three equivalent O(3) atoms to form MgO6 octahedra that share corners with six equivalent P(1)O4 tetrahedra. Fe(1) is bonded to three equivalent O(2) and three equivalent O(4) atoms to form FeO6 octahedra that share corners with six equivalent P(1)O4 tetrahedra. P(1) is bonded to one O(1), one O(2), one O(3), and one O(4) atom to form PO4 tetrahedra that share corners with two equivalent Mg(1)O6 octahedra and corners with two equivalent Fe(1)O6 octahedra. The corner-sharing octahedral tilt angles range from 29-40°. There are four inequivalent O sites. In the first O site, O(3) is bonded to one Na(2), two equivalent Na(1), one Mg(1), and one P(1) atom to form distorted ONa3MgP trigonal bipyramids that share corners with six equivalent O(4)Na3FeP trigonal bipyramids,  an edgeedge with one O(4)Na3FeP trigonal bipyramid, and faces with two equivalent O(3)Na3MgP trigonal bipyramids. In the second O site, O(4) is bonded to one Na(2), two equivalent Na(1), one Fe(1), and one P(1) atom to form distorted ONa3FeP trigonal bipyramids that share corners with six equivalent O(3)Na3MgP trigonal bipyramids,  an edgeedge with one O(3)Na3MgP trigonal bipyramid, and faces with two equivalent O(4)Na3FeP trigonal bipyramids. In the third O site, O(1) is bonded in a 3-coordinate geometry to one Na(1), one Mg(1), and one P(1) atom. In the fourth O site, O(2) is bonded in a 2-coordinate geometry to one Na(1), one Fe(1), and one P(1) atom.
Na4MgFe(PO4)3 crystallizes in the trigonal R3c space group. There are two inequivalent Na sites. In the first Na site, Na(1) is bonded in a 6-coordinate geometry to one O(1), one O(2), two equivalent O(3), and two equivalent O(4) atoms. The Na(1)-O(1) bond length is 2.54 Å. The Na(1)-O(2) bond length is 2.64 Å. There is one shorter (2.43 Å) and one longer (2.48 Å) Na(1)-O(3) bond length. There is one shorter (2.48 Å) and one longer (2.53 Å) Na(1)-O(4) bond length. In the second Na site, Na(2) is bonded in a distorted hexagonal planar geometry to three equivalent O(3) and three equivalent O(4) atoms. All Na(2)-O(3) bond lengths are 2.46 Å. All Na(2)-O(4) bond lengths are 2.48 Å. Mg(1) is bonded to three equivalent O(1) and three equivalent O(3) atoms to form MgO6 octahedra that share corners with six equivalent P(1)O4 tetrahedra. All Mg(1)-O(1) bond lengths are 2.02 Å. All Mg(1)-O(3) bond lengths are 2.13 Å. Fe(1) is bonded to three equivalent O(2) and three equivalent O(4) atoms to form FeO6 octahedra that share corners with six equivalent P(1)O4 tetrahedra. All Fe(1)-O(2) bond lengths are 2.00 Å. All Fe(1)-O(4) bond lengths are 2.10 Å. P(1) is bonded to one O(1), one O(2), one O(3), and one O(4) atom to form PO4 tetrahedra that share corners with two equivalent Mg(1)O6 octahedra and corners with two equivalent Fe(1)O6 octahedra. The corner-sharing octahedral tilt angles range from 29-40°. The P(1)-O(1) bond length is 1.53 Å. The P(1)-O(2) bond length is 1.57 Å. The P(1)-O(3) bond length is 1.54 Å. The P(1)-O(4) bond length is 1.57 Å. There are four inequivalent O sites. In the first O site, O(3) is bonded to one Na(2), two equivalent Na(1), one Mg(1), and one P(1) atom to form distorted ONa3MgP trigonal bipyramids that share corners with six equivalent O(4)Na3FeP trigonal bipyramids,  an edgeedge with one O(4)Na3FeP trigonal bipyramid, and faces with two equivalent O(3)Na3MgP trigonal bipyramids. In the second O site, O(4) is bonded to one Na(2), two equivalent Na(1), one Fe(1), and one P(1) atom to form distorted ONa3FeP trigonal bipyramids that share corners with six equivalent O(3)Na3MgP trigonal bipyramids,  an edgeedge with one O(3)Na3MgP trigonal bipyramid, and faces with two equivalent O(4)Na3FeP trigonal bipyramids. In the third O site, O(1) is bonded in a 3-coordinate geometry to one Na(1), one Mg(1), and one P(1) atom. In the fourth O site, O(2) is bonded in a 2-coordinate geometry to one Na(1), one Fe(1), and one P(1) atom.