Crystal packing similarity¶
Note
The crystal packing similarity features are available only to CSD-Materials and CSD-Enterprise users.
Introduction¶
A crystal packing similarity metric may be calculated for very similar crystals. This metric is described in “COMPACK: a program for identifying crystal structure similarity using distances”, J.A. Chisholm and S. Motherwell, J. Appl. Cryst. 38, 228–231, 2005. DOI: 10.1107/S0021889804027074.
This is a method to identify similarity in molecular packing environments within crystal structures. The method can be used to determine whether two crystal structures are the same to within specified tolerances and also provides a measure of similarity for structures that do not match exactly, but have common structural features. The relative position and orientation of molecules is captured using interatomic distances. This is a representation of structure that avoids use of space-group and cell information.
Using the Packing Similarity API¶
Firstly we shall import the ccdc.crystal.PackingSimilarity
class and instantiate it:
>>> from ccdc.crystal import PackingSimilarity
>>> similarity_engine = PackingSimilarity()
The similarity engine has two significant methods, to compare to packing shells.
>>> h = similarity_engine.compare(reference_crystal, comparison_crystal)
OR
>>> h = similarity_engine.compare_with_filtering(reference_crystals, comparison_crystals, atom_shell_size, pdd_threshold, amd_threshold)
The first one is useful for comparing just a pair of structures or can be used in a larger program to compare lists of structures. The second one is much more useful for comparing huge lists of structures using the geometric filter discussed in the next section.
We shall need a couple of crystals to compare:
>>> from ccdc.io import CrystalReader
>>> csd = CrystalReader('csd')
>>> fetsec = csd.crystal('FETSEC')
>>> zerlud = csd.crystal('ZERLUD')
By default the packing similarity engine prohibits the comparison of different molecular structures. This restriction can be disabled:
>>> similarity_engine.settings.allow_molecular_differences = True
Then the structures can be compared:
>>> h = similarity_engine.compare(fetsec, zerlud)
The returned value is an instance of ccdc.crystal.PackingSimilarity.Comparison
. It supports
properties to extract the number of molecules of the packing shell which are matched, the number of
molecules in the packing shell and the RMSD of the matched structures:
>>> print(h.nmatched_molecules)
9
>>> print(h.packing_shell_size)
15
>>> print(round(h.rmsd, 3))
0.183
The ccdc.crystal.PackingSimilarity
contains a nested class, ccdc.crystal.PackingSimilarity.Settings
allowing aspects of the similarity measure to be inspected or modified. For example, the distance tolerance which
is measured in percent. Relaxing this tolerance will allow more molecules to match with a concomitant raising
of the RMSD:
>>> print(similarity_engine.settings.distance_tolerance)
0.2
>>> similarity_engine.settings.distance_tolerance = 0.4
>>> similarity_engine.settings.angle_tolerance = 40.
>>> h = similarity_engine.compare(fetsec, zerlud)
>>> print('Number of molecules matched: %d, RMSD: %.3f' % (h.nmatched_molecules, h.rmsd))
Number of molecules matched: 11, RMSD: 1.959
See also