Quantifying the similarity of crystal structures is important to understand and predict the properties of less-studied crystals. For example, the inorganic crystal structure database (ICSD) contains over 200,000 crystal structures and most crystal structures are labelled with a "structure type" in addition to other symmetry information and experimental details. $\ce{Fe2O3}$, for instance belongs to Corundum $\ce{Al2O3}$ structure indicating high similarity between these two crystals. I wonder whether they find "structure type" by manual inspection.

My question is, are there any high-throughput tools to compare crystal structures and obtain a similarity measure between them? Ideally, I should be able to load crystal structures from a standard file format such as cif and quantify their similarity using a python/bash program. Is this feature available in tools such as pymatgen, ase, etc.?

I understand that I can try to represent crystal structures with conventional methods such as coulomb matrix or more recent methods such as crystal graph neural network and then, capture cosine similarity between latent representations. But are there any out-of-the-box tools to do this?


2 Answers 2


As Thomas mentioned, there are tools from Materials Project that we use for structure similarity. See for example this paper, with code available in pymatgen. This works by creating local environment "fingerprints" (e.g. octahedral, tetrahedral sites, etc.) and creating a distance between structures based on this.

Other that this, one method I'm very fond of is the one described in this paper using the SOAP descriptor. I can highly recommend the implementation of this in DScribe. This is actually quite performant and mathematically elegant. The disadvantage of this approach is that it doesn’t give as much human insight, since the SOAP vectors are more difficult to interpret than the local environment vectors (which can give values like “the degree of octahedral-ness”).

I've implemented several of these for interactive use in crystal toolkit if you want to try them out -- take a look at the "local environment" panel.

I wouldn’t necessarily advise the neural network / cosine similarity approach. While this would likely work well, it’s also over-complicating the problem.

Apologies, I would offer a longer response if I had the time, but I hope this is a good place to get started! If you have any questions about the Materials Project methods specifically, feel free to ask us about them at matsci.org.

  • 1
    $\begingroup$ Unrelated to this post, but since you are here, I put an ad for matsci.org on our Meta. If you felt there was anything more to add or change, you can let me know or it should be editable. $\endgroup$
    – Tyberius
    Jun 24, 2021 at 20:13
  • $\begingroup$ Thanks Tyberius, very kind! $\endgroup$ Jun 24, 2021 at 22:00

Not sure what your input files are, but there's a technique based on spherical harmonics that is relevant described here: High Throughput Profiling of Molecular Shapes in Crystals https://doi.org/10.1038/srep22204

The spherical harmonics approximate the shape of the electron distribution. They are then made rotationally invariant, and result in a descriptor that can be compared very quickly by calculating Euclidean distance between descriptors.

The chmpy (https://github.com/peterspackman/chmpy) library implements something similar. The library itself may not be complete, but it looks like it has molecule descriptors for crystals (from chmpy/docs/shape_descriptors.md):

from chmpy import Crystal
c = Crystal.load("tests/test_files/acetic_acid.cif")

# calculate shape descriptors for each molecule in the asymmetric unit
desc = c.molecular_shape_descriptors()

PS you'll need to install the library SHTns manually to use the descriptors. Also note that the author of chnpy looks to be the lead author of that publication.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .