CsMgH3 crystallizes in the trigonal R-3m space group. There are two inequivalent Cs sites. In the first Cs site, Cs(1) is bonded to six equivalent H(1) and six equivalent H(2) atoms to form CsH12 cuboctahedra that share corners with six equivalent Cs(1)H12 cuboctahedra, corners with six equivalent Mg(1)H6 octahedra, faces with eight equivalent Cs(2)H12 cuboctahedra, and faces with six equivalent Mg(2)H6 octahedra. The corner-sharing octahedral tilt angles are 7°. In the second Cs site, Cs(2) is bonded to three equivalent H(1) and nine equivalent H(2) atoms to form distorted CsH12 cuboctahedra that share corners with nine equivalent Cs(2)H12 cuboctahedra, corners with three equivalent Mg(2)H6 octahedra, faces with three equivalent Cs(2)H12 cuboctahedra, faces with four equivalent Cs(1)H12 cuboctahedra, faces with three equivalent Mg(1)H6 octahedra, and faces with four equivalent Mg(2)H6 octahedra. The corner-sharing octahedral tilt angles are 5°. There are two inequivalent Mg sites. In the first Mg site, Mg(1) is bonded to six equivalent H(2) atoms to form MgH6 octahedra that share corners with six equivalent Cs(1)H12 cuboctahedra, faces with six equivalent Cs(2)H12 cuboctahedra, and faces with two equivalent Mg(2)H6 octahedra. In the second Mg site, Mg(2) is bonded to three equivalent H(1) and three equivalent H(2) atoms to form MgH6 octahedra that share corners with three equivalent Cs(2)H12 cuboctahedra, corners with three equivalent Mg(2)H6 octahedra, faces with three equivalent Cs(1)H12 cuboctahedra, faces with four equivalent Cs(2)H12 cuboctahedra, and  a faceface with one Mg(1)H6 octahedra. The corner-sharing octahedra are not tilted. There are two inequivalent H sites. In the first H site, H(1) is bonded in a distorted linear geometry to two equivalent Cs(1), two equivalent Cs(2), and two equivalent Mg(2) atoms. In the second H site, H(2) is bonded in a distorted L-shaped geometry to one Cs(1), three equivalent Cs(2), one Mg(1), and one Mg(2) atom.
CsMgH3 crystallizes in the trigonal R-3m space group. There are two inequivalent Cs sites. In the first Cs site, Cs(1) is bonded to six equivalent H(1) and six equivalent H(2) atoms to form CsH12 cuboctahedra that share corners with six equivalent Cs(1)H12 cuboctahedra, corners with six equivalent Mg(1)H6 octahedra, faces with eight equivalent Cs(2)H12 cuboctahedra, and faces with six equivalent Mg(2)H6 octahedra. The corner-sharing octahedral tilt angles are 7°. All Cs(1)-H(1) bond lengths are 3.12 Å. All Cs(1)-H(2) bond lengths are 3.20 Å. In the second Cs site, Cs(2) is bonded to three equivalent H(1) and nine equivalent H(2) atoms to form distorted CsH12 cuboctahedra that share corners with nine equivalent Cs(2)H12 cuboctahedra, corners with three equivalent Mg(2)H6 octahedra, faces with three equivalent Cs(2)H12 cuboctahedra, faces with four equivalent Cs(1)H12 cuboctahedra, faces with three equivalent Mg(1)H6 octahedra, and faces with four equivalent Mg(2)H6 octahedra. The corner-sharing octahedral tilt angles are 5°. All Cs(2)-H(1) bond lengths are 3.22 Å. There are six shorter (3.15 Å) and three longer (3.17 Å) Cs(2)-H(2) bond lengths. There are two inequivalent Mg sites. In the first Mg site, Mg(1) is bonded to six equivalent H(2) atoms to form MgH6 octahedra that share corners with six equivalent Cs(1)H12 cuboctahedra, faces with six equivalent Cs(2)H12 cuboctahedra, and faces with two equivalent Mg(2)H6 octahedra. All Mg(1)-H(2) bond lengths are 1.97 Å. In the second Mg site, Mg(2) is bonded to three equivalent H(1) and three equivalent H(2) atoms to form MgH6 octahedra that share corners with three equivalent Cs(2)H12 cuboctahedra, corners with three equivalent Mg(2)H6 octahedra, faces with three equivalent Cs(1)H12 cuboctahedra, faces with four equivalent Cs(2)H12 cuboctahedra, and  a faceface with one Mg(1)H6 octahedra. The corner-sharing octahedra are not tilted. All Mg(2)-H(1) bond lengths are 2.07 Å. All Mg(2)-H(2) bond lengths are 2.01 Å. There are two inequivalent H sites. In the first H site, H(1) is bonded in a distorted linear geometry to two equivalent Cs(1), two equivalent Cs(2), and two equivalent Mg(2) atoms. In the second H site, H(2) is bonded in a distorted L-shaped geometry to one Cs(1), three equivalent Cs(2), one Mg(1), and one Mg(2) atom.