示例#1
0
def check_and_set_crystal_symmetry(models=[], map_inps=[], miller_arrays=[]):
    # XXX This should go into a central place
    # XXX Check map gridding here!
    for it in [models, map_inps, miller_arrays]:
        assert isinstance(it, (list, tuple))
    crystal_symmetry = None
    css = []
    all_inputs = models + map_inps + miller_arrays
    for it in all_inputs:
        if (it is not None):
            it = it.crystal_symmetry()
            if (it is None): continue
            if (not [it.unit_cell(), it.space_group()].count(None) in [0, 2]):
                raise Sorry("Inconsistent box (aka crystal symmetry) info.")
            if ([it.unit_cell(), it.space_group()].count(None) == 0):
                css.append(it)
    if (len(css) > 1):
        cs0 = css[0]
        for cs in css[1:]:
            if (not cs0.is_similar_symmetry(cs)):
                raise Sorry(
                    "Box info (aka crystal symmetry) mismatch across inputs.")
    if (len(css) == 0):
        raise Sorry("No box info (aka crystal symmetry) available.")
    crystal_symmetry = css[0]
    for model in models:
        if (model is None): continue
        cs = model.crystal_symmetry()
        if (cs is None or [cs.unit_cell(), cs.space_group()].count(None) == 2):
            model.set_crystal_symmetry_if_undefined(crystal_symmetry)
    if (len(map_inps) > 1):
        m0 = map_inps[0].map_data()
        for m in map_inps[1:]:
            if (m is None): continue
            maptbx.assert_same_gridding(map_1=m0, map_2=m.map_data())
示例#2
0
def assert_same_gridding(map_1, map_2):
  # XXX remove it!
  maptbx.assert_same_gridding(map_1, map_2)