Example #1
0
def non_crystallographic_asu_mappings(
      sites_cart,
      default_buffer_layer=0.5,
      min_unit_cell_length=0):
  sites_min = sites_cart.min()
  sites_max = sites_cart.max()
  crystal_symmetry = crystal.non_crystallographic_symmetry(
      sites_cart_min=sites_min,
      sites_cart_max=sites_max,
      default_buffer_layer=default_buffer_layer,
      min_unit_cell_length=min_unit_cell_length)
  buffer_layer = uctbx.non_crystallographic_buffer_layer(
      sites_cart_min=sites_min,
      sites_cart_max=sites_max,
      default_buffer_layer=default_buffer_layer)
  sites_min = crystal_symmetry.unit_cell().fractionalize(sites_min)
  sites_max = crystal_symmetry.unit_cell().fractionalize(sites_max)
  asu_cuts = [float_cut_plane(n=n,c=c) for n,c in [
    ([1,0,0],-sites_min[0]),
    ([-1,0,0],sites_max[0]),
    ([0,1,0],-sites_min[1]),
    ([0,-1,0],sites_max[1]),
    ([0,0,1],-sites_min[2]),
    ([0,0,-1],sites_max[2]),
  ]]
  result = asu_mappings(
    space_group=crystal_symmetry.space_group(),
    asu=float_asu(
      unit_cell=crystal_symmetry.unit_cell(),
      cuts=asu_cuts).add_buffer(thickness=buffer_layer),
    buffer_thickness=0)
  result.process_sites_cart(original_sites=sites_cart)
  return result
Example #2
0
def exercise_non_crystallographic_symmetry():
  sites_cart = flex.vec3_double(
    [(0.28730079491792732, 0.14711550696452974, 0.13031757579425293),
     (0.26144164573900441, 0.26385801128667269, 0.24113874888074088),
     (0.19728759424697784, 0.93346148983888833, 0.91783953828686837)])
  n = crystal.non_crystallographic_symmetry(sites_cart=sites_cart)
  assert approx_equal(n.unit_cell().parameters(),
    (1.6650571, 2.3613899, 2.36256589, 90, 90, 90))
  assert n.space_group_info().type().number() == 1
  n = crystal.non_crystallographic_symmetry(
    sites_cart=sites_cart, min_unit_cell_length=2)
  assert approx_equal(n.unit_cell().parameters(),
    (2, 2.3613899, 2.36256589, 90, 90, 90))
  sites_cart = flex.vec3_double(
    [(0.28730079491792732, 0.14711550696452974, 0.13031757579425293)])
  n = crystal.non_crystallographic_symmetry(sites_cart=sites_cart)
  assert approx_equal(n.unit_cell().parameters(), (1, 1, 1, 90, 90, 90))
  n = crystal.non_crystallographic_symmetry(
    sites_cart=sites_cart, default_buffer_layer=1.5)
  assert approx_equal(n.unit_cell().parameters(), (3, 3, 3, 90, 90, 90))
Example #3
0
def exercise_non_crystallographic_symmetry():
  sites_cart = flex.vec3_double(
    [(0.28730079491792732, 0.14711550696452974, 0.13031757579425293),
     (0.26144164573900441, 0.26385801128667269, 0.24113874888074088),
     (0.19728759424697784, 0.93346148983888833, 0.91783953828686837)])
  n = crystal.non_crystallographic_symmetry(sites_cart=sites_cart)
  assert approx_equal(n.unit_cell().parameters(),
    (1.6650571, 2.3613899, 2.36256589, 90, 90, 90))
  assert n.space_group_info().type().number() == 1
  n = crystal.non_crystallographic_symmetry(
    sites_cart=sites_cart, min_unit_cell_length=2)
  assert approx_equal(n.unit_cell().parameters(),
    (2, 2.3613899, 2.36256589, 90, 90, 90))
  sites_cart = flex.vec3_double(
    [(0.28730079491792732, 0.14711550696452974, 0.13031757579425293)])
  n = crystal.non_crystallographic_symmetry(sites_cart=sites_cart)
  assert approx_equal(n.unit_cell().parameters(), (1, 1, 1, 90, 90, 90))
  n = crystal.non_crystallographic_symmetry(
    sites_cart=sites_cart, default_buffer_layer=1.5)
  assert approx_equal(n.unit_cell().parameters(), (3, 3, 3, 90, 90, 90))