Cleaning structures

chic can be used to “clean-up” disordered structures. Here, I show how the thermal disorder in the methyl-substituted imidazolate molecules in a ZIF can be averaged to single positions.

In this case study, I will use the load_atoms Python package for visualising the molecules. You can instsall it easily with pip install load-atoms. Below is a helper function:

viz.py
from load_atoms import view
from IPython.core.display import HTML
from pymatgen.io.ase import AseAtomsAdaptor
from chic.atomic_cluster import AtomicCluster

def view_molecule(cluster: AtomicCluster) -> HTML:
    """
    Convert the building unit to an ASE Atoms object and inspect it with 
    load-atoms visaulisation tool.

    Arguments:
        cluster (AtomicCluster): the building unit to inspect.
    
    Returns:
        The HTML visualisation.
    """
    molecule = AseAtomsAdaptor.get_atoms(cluster.to_molecule())
    return view(molecule, show_bonds=True)

First, let’s load the ZIF-8 structure.

>>> from chic import Structure
>>> from viz import view_molecule
>>> mof = Structure.from_cif("ZIF-8-sod.cif")
>>> mof.remove_sites_by_symbol("O")
>>> mof.get_neighbours_crystalnn()
>>> mof.find_atomic_clusters()

Let’s visualise the cluster.

>>> disordered_linker = mof.atomic_clusters[("b", 1)]
>>> view_molecule(disordered_linker)

We can “fix” this by averaging pairs of H atoms within a distance of 0.9 Å of each other. Note, after inserting/deleting atoms, we need to force a rebuild of the neighbourlist. It is therefore advised to perform structral cleaning before further analysis.

>>> mof.average_element_pairs("H", rmax=0.9)
>>> mof.get_neighbours_crystalnn(force=True)
>>> mof.find_atomic_clusters()
>>> ordered_linker = mof.atomic_clusters[("b", 1)]
>>> view_molecule(ordered_linker)

We can write the ordered structure back to a CIF using Pymatgen functionality directly.

>>> mof.to("ZIF-8-sod-ordered.cif");