Three-dimensional electron diffraction and topological analysis Three-dimensional electron diffraction (3D ED) data (Supplementary Tables ) were collected using a JEOL JEM2100 TEM, equipped with a Timepix detector from Amsterdam Scientific Instruments, while continuously rotating the crystal at 0.45° s -1 . The experiment was carried out using Instamatic , with data reduction performed in XDS . The acquired intensities were then used to solve the structures with SHELXT , and refined using SHELXL using electron scattering factors and interfaced with Olex2-1.5 . From the 3D ED data, all nonhydrogen atoms of the frameworks were located in the initial structure solution. In most cases all non-hydrogen atoms of the ammonium species were also located in the initial structure solution. For ammonium species with long flexible alkyl chains, some of the more disordered peripheral atoms were geometrically placed in chemically reasonable positions and their positions were refined while applying distance and angle restraints. Topological analysis was carried out using the software package ToposPro .