示例#1
0
def crystal_model_from_mosflm_mat(mosflm_mat_lines, unit_cell, space_group):
  from scitbx import matrix
  from cctbx import uctbx
  if not isinstance(unit_cell, uctbx.unit_cell):
    unit_cell = uctbx.unit_cell(unit_cell)
  from dxtbx.model.crystal import crystal_model_from_mosflm_matrix
  mosflm_matrix = matrix.sqr([float(i) for line in mosflm_mat_lines[:3]
                              for i in line.split()][:9])
  crystal_model = crystal_model_from_mosflm_matrix(
    mosflm_matrix,
    unit_cell=unit_cell,
    space_group=space_group)
  return crystal_model
def exercise_crystal_model_from_mosflm_matrix():
  mosflm_matrix = map(float, ''' -0.00495480 -0.01491776  0.00238445
  0.01505572 -0.00661190 -0.00149401
  0.00585043  0.00438127  0.00586415
       0.000       0.000       0.000
  -0.2932645  -0.8829514   0.3665960
   0.8911171  -0.3913446  -0.2296951
   0.3462750   0.2593185   0.9015806
     57.7822     57.7822    150.0931     90.0000     90.0000     90.0000
       0.000       0.000       0.000'''.split())
  A = mosflm_matrix[:9]
  unit_cell = uctbx.unit_cell(mosflm_matrix[21:27])
  cm = crystal_model_from_mosflm_matrix(A, unit_cell=unit_cell)
  assert approx_equal(cm.get_unit_cell().parameters(),
                      unit_cell.parameters(), eps=1.0e-2)
示例#3
0
def exercise_crystal_model_from_mosflm_matrix():
    mosflm_matrix = map(
        float, ''' -0.00495480 -0.01491776  0.00238445
  0.01505572 -0.00661190 -0.00149401
  0.00585043  0.00438127  0.00586415
       0.000       0.000       0.000
  -0.2932645  -0.8829514   0.3665960
   0.8911171  -0.3913446  -0.2296951
   0.3462750   0.2593185   0.9015806
     57.7822     57.7822    150.0931     90.0000     90.0000     90.0000
       0.000       0.000       0.000'''.split())
    A = mosflm_matrix[:9]
    unit_cell = uctbx.unit_cell(mosflm_matrix[21:27])
    cm = crystal_model_from_mosflm_matrix(A, unit_cell=unit_cell)
    assert approx_equal(cm.get_unit_cell().parameters(),
                        unit_cell.parameters(),
                        eps=1.0e-2)