[cctbxbb] Best way to compare two structures using cctbx?

Jan Marten Simons marten at xtal.rwth-aachen.de
Tue Mar 12 10:19:41 PDT 2013


Am Montag 04 März 2013 16:18:03 schrieb Luc Bourhis:
> Hi Jan,
> 
> the cctbx does not have a tool doing exactly what you describe. But there
> is cctbx.euclidean_model_matching, that we all call emma, which could be
> close enough. It tries to find the best isometry matching the biggest
> subset of the 1st structure onto the 2nd structure, and since an isometry
> preserves bond lengths, angles and even torsion angles, perhaps you may
> find that tool useful. Here is a very quick kickstarter:
> 
> Starting from two instances of xray.structure xs1 and xs2 for the two
> structures you wish to compare, the following is all you need to do

Seems I praised emma a little bit too soon, as this example leads to an 
exception:

----8<------------------------------------------------------------------

from cctbx import xray
from cctbx import crystal
from cctbx.array_family import flex
from cctbx import euclidean_model_matching as emma

xs1=xray.structure(
  crystal_symmetry=crystal.symmetry(
    unit_cell=(4.98599, 6.48179, 8.47619, 83, 109, 129),
    space_group_symbol="P -1"),
  scatterers=flex.xray_scatterer([
    xray.scatterer( #0
      label="C1",
      site=(0.710543, 0.440181, 0.852614),
      u=0.005000),
    xray.scatterer( #1
      label="C2",
      site=(0.305308, 0.127783, 0.856840),
      u=0.005000)]))

xs2=xray.structure(
  crystal_symmetry=crystal.symmetry(
    unit_cell=(4.98599, 6.48179, 8.47619, 83, 109, 129),
    space_group_symbol="P -1"),
  scatterers=flex.xray_scatterer([
    xray.scatterer( #0
      label="C1",
      site=(0.199543, 0.159467, 0.002565),
      u=0.001260),
    xray.scatterer( #1
      label="C2",
      site=(0.205553, 0.153391, 0.002025),
      u=0.001260)]))

m = emma.model_matches(
    xs1.as_emma_model(),
    xs2.as_emma_model(),
    tolerance=0.5,
    break_if_match_with_no_singles=False
    ).refined_matches[0]

print(m.rms)
 
----8<------------------------------------------------------------------

I've got no idea as to why those two (random) structures cannot be compared. 
Have I found a bug in emma?


With regards,

 Dipl. Phys.
  Jan M. Simons
 
Institute of Crystallography
RWTH Aachen University


More information about the cctbxbb mailing list