Example #1
0
def run(server_info, inp, status):
    print "<pre>"

    io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
    crystal_symmetry = crystal.symmetry(
        unit_cell=uctbx.unit_cell(inp.ucparams),
        space_group_info=sgtbx.space_group_info(symbol=inp.sgsymbol,
                                                table_id=inp.convention))
    crystal_symmetry.show_summary()
    print

    change_of_hand_op \
      = crystal_symmetry.space_group_info().type().change_of_hand_op()
    print "Change-of-hand matrix:", change_of_hand_op.c()
    print "              Inverse:", change_of_hand_op.c_inv()
    print

    print inp.coor_type, "coordinates:"
    print

    skip_columns = io_utils.interpret_skip_columns(inp.skip_columns)

    for line in inp.coordinates:
        skipped, coordinates = io_utils.interpret_coordinate_line(
            line, skip_columns)
        if (inp.coor_type != "Fractional"):
            coordinates = crystal_symmetry.unit_cell().fractionalize(
                coordinates)
        flipped_coordinates = change_of_hand_op(coordinates)
        if (inp.coor_type != "Fractional"):
            flipped_coordinates \
              = crystal_symmetry.unit_cell().orthogonalize(flipped_coordinates)
        print skipped, "%.6g %.6g %.6g" % tuple(flipped_coordinates)

    print "</pre>"
Example #2
0
def run(server_info, inp, status):
    print "<pre>"
    # check input to prevent XSS
    try:
        unit_cell = uctbx.unit_cell(inp.ucparams)
        space_group_info = sgtbx.space_group_info(symbol=inp.sgsymbol,
                                                  table_id=inp.convention)
    except Exception:
        print "Please check your inputs."
        print "</pre>"
        return
    io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
    special_position_settings = crystal.special_position_settings(
        crystal.symmetry(unit_cell=uctbx.unit_cell(inp.ucparams),
                         space_group_info=sgtbx.space_group_info(
                             symbol=inp.sgsymbol, table_id=inp.convention)),
        min_distance_sym_equiv=float(inp.min_distance_sym_equiv))
    special_position_settings.show_summary()
    print "Minimum distance between symmetrically equivalent sites:",
    print special_position_settings.min_distance_sym_equiv()
    print

    skip_columns = io_utils.interpret_skip_columns(inp.skip_columns)

    wyckoff_table = special_position_settings.space_group_info().wyckoff_table(
    )
    unit_cell = special_position_settings.unit_cell()
    print "</pre><table border=2 cellpadding=2>"
    status.in_table = True
    print "<tr>"
    if (skip_columns): print "<th>"
    print "<th colspan=3>" + inp.coor_type + " coordinates"
    print "<th>Multiplicity"
    print "<th>Wyckoff letter"
    print "<th>Site symmetry<br>point group type"
    print "<th>Special position operator"
    print "</tr>"
    for line in inp.coordinates:
        skipped, coordinates = io_utils.interpret_coordinate_line(
            line, skip_columns)
        if (inp.coor_type != "Fractional"):
            coordinates = unit_cell.fractionalize(coordinates)
        site_symmetry = special_position_settings.site_symmetry(coordinates)
        exact_site = site_symmetry.exact_site()
        if (inp.coor_type != "Fractional"):
            exact_site = unit_cell.orthogonalize(exact_site)
        wyckoff_mapping = wyckoff_table.mapping(site_symmetry)
        print "<tr>"
        if (skip_columns): print "<td>", skipped
        for x in exact_site:
            print "<td><tt>%.6g</tt>" % (x, )
        print "<td align=center>", wyckoff_mapping.position().multiplicity()
        print "<td align=center>", wyckoff_mapping.position().letter()
        print "<td align=center>", site_symmetry.point_group_type()
        print "<td><tt>" + str(site_symmetry.special_op_simplified()) + "</tt>"
        print "</tr>"
    print "</table><pre>"
    status.in_table = False

    print "</pre>"
Example #3
0
def run(server_info, inp, status):
  print "<pre>"

  io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
  crystal_symmetry = crystal.symmetry(
      unit_cell=uctbx.unit_cell(inp.ucparams),
      space_group_info=sgtbx.space_group_info(
        symbol=inp.sgsymbol,
        table_id=inp.convention))
  crystal_symmetry.show_summary()
  print

  change_of_hand_op \
    = crystal_symmetry.space_group_info().type().change_of_hand_op()
  print "Change-of-hand matrix:", change_of_hand_op.c()
  print "              Inverse:", change_of_hand_op.c_inv()
  print

  print inp.coor_type, "coordinates:"
  print

  skip_columns = io_utils.interpret_skip_columns(inp.skip_columns)

  for line in inp.coordinates:
    skipped, coordinates = io_utils.interpret_coordinate_line(line,skip_columns)
    if (inp.coor_type != "Fractional"):
      coordinates = crystal_symmetry.unit_cell().fractionalize(coordinates)
    flipped_coordinates = change_of_hand_op(coordinates)
    if (inp.coor_type != "Fractional"):
      flipped_coordinates \
        = crystal_symmetry.unit_cell().orthogonalize(flipped_coordinates)
    print skipped, "%.6g %.6g %.6g" % tuple(flipped_coordinates)

  print "</pre>"
def run(server_info, inp, status):
  print "<pre>"
  io_utils.show_input_symbol(inp.sgsymbol, inp.convention)

  symbols_inp = None
  lookup_symbol = inp.sgsymbol
  if (lookup_symbol == ""): lookup_symbol = "P 1"
  if (inp.convention == "Hall"):
    hall_symbol = lookup_symbol
  else:
    symbols_inp = sgtbx.space_group_symbols(lookup_symbol, inp.convention)
    hall_symbol = symbols_inp.hall()
    if (symbols_inp.number() == 0):
      symbols_inp = None
      inp.convention = "Hall"
    else:
      print "Result of symbol lookup:"
      show_symbols(symbols_inp)
      print

  try:
    ps = sgtbx.parse_string(hall_symbol)
    sg = sgtbx.space_group(ps)
  except RuntimeError, e:
    print "--&gt;" + ps.string() + "&lt;--"
    print ("-" * (ps.where() + 3)) + "^"
    raise
Example #5
0
def run(server_info, inp, status):
  print "<pre>"
  io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
  special_position_settings = crystal.special_position_settings(
    crystal.symmetry(
      unit_cell=uctbx.unit_cell(inp.ucparams),
      space_group_info=sgtbx.space_group_info(
        symbol=inp.sgsymbol,
        table_id=inp.convention)),
    min_distance_sym_equiv=float(inp.min_distance_sym_equiv))
  special_position_settings.show_summary()
  print "Minimum distance between symmetrically equivalent sites:",
  print special_position_settings.min_distance_sym_equiv()
  print

  skip_columns = io_utils.interpret_skip_columns(inp.skip_columns)

  wyckoff_table=special_position_settings.space_group_info().wyckoff_table()
  unit_cell = special_position_settings.unit_cell()
  print "</pre><table border=2 cellpadding=2>"
  status.in_table = True
  print "<tr>"
  if (skip_columns): print "<th>"
  print "<th colspan=3>" + inp.coor_type + " coordinates"
  print "<th>Multiplicity"
  print "<th>Wyckoff letter"
  print "<th>Site symmetry<br>point group type"
  print "<th>Special position operator"
  print "</tr>"
  for line in inp.coordinates:
    skipped, coordinates = io_utils.interpret_coordinate_line(line,skip_columns)
    if (inp.coor_type != "Fractional"):
      coordinates = unit_cell.fractionalize(coordinates)
    site_symmetry = special_position_settings.site_symmetry(coordinates)
    exact_site = site_symmetry.exact_site()
    if (inp.coor_type != "Fractional"):
      exact_site = unit_cell.orthogonalize(exact_site)
    wyckoff_mapping = wyckoff_table.mapping(site_symmetry)
    print "<tr>"
    if (skip_columns): print "<td>", skipped
    for x in exact_site: print "<td><tt>%.6g</tt>" % (x,)
    print "<td align=center>", wyckoff_mapping.position().multiplicity()
    print "<td align=center>", wyckoff_mapping.position().letter()
    print "<td align=center>", site_symmetry.point_group_type()
    print "<td><tt>" + str(site_symmetry.special_op_simplified()) + "</tt>"
    print "</tr>"
  print "</table><pre>"
  status.in_table = False

  print "</pre>"
      symbols_inp = None
      inp.convention = "Hall"
    else:
      print "Result of symbol lookup:"
      show_symbols(symbols_inp)
      print

  try:
    ps = sgtbx.parse_string(hall_symbol)
    sg = sgtbx.space_group(ps)
  except RuntimeError, e:
    print "--&gt;" + ps.string() + "&lt;--"
    print ("-" * (ps.where() + 3)) + "^"
    raise

  io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
  if (len(inp.shelx_latt) != 0):
    for n_fld in inp.shelx_latt:
      expand_shelx_latt(sg, n_fld)

  if (len(inp.symxyz) != 0):
    print "Addition of symmetry operations:"
    print "</pre><table border=2 cellpadding=2>"
    status.in_table = True
    rt_mx_analysis_header()
    for s in inp.symxyz:
      ps = sgtbx.parse_string(s)
      try:
        s = sgtbx.rt_mx(ps)
      except RuntimeError, e:
        print "</table><pre>"
Example #7
0
def run(server_info, inp, status):
    print("<pre>")

    symbols_inp = None
    lookup_symbol = inp.sgsymbol
    if (lookup_symbol == ""): lookup_symbol = "P 1"
    if (inp.convention == "Hall"):
        hall_symbol = lookup_symbol
    else:
        symbols_inp = sgtbx.space_group_symbols(lookup_symbol, inp.convention)
        hall_symbol = symbols_inp.hall()
        if (symbols_inp.number() == 0):
            symbols_inp = None
            inp.convention = "Hall"
        else:
            print("Result of symbol lookup:")
            show_symbols(symbols_inp)
            print()

    try:
        ps = sgtbx.parse_string(hall_symbol)
        sg = sgtbx.space_group(ps)
    except RuntimeError as e:
        print("--&gt;" + ps.string() + "&lt;--")
        print(("-" * (ps.where() + 3)) + "^")
        raise

    io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
    if (len(inp.shelx_latt) != 0):
        for n_fld in inp.shelx_latt:
            expand_shelx_latt(sg, n_fld)

    if (len(inp.symxyz) != 0):
        print("Addition of symmetry operations:")
        print("</pre><table border=2 cellpadding=2>")
        status.in_table = True
        rt_mx_analysis_header()
        for s in inp.symxyz:
            ps = sgtbx.parse_string(s)
            try:
                s = sgtbx.rt_mx(ps)
            except RuntimeError as e:
                print("</table><pre>")
                status.in_table = False
                print("--&gt;" + ps.string() + "&lt;--")
                print(("-" * (ps.where() + 3)) + "^")
                raise
            rt_mx_analysis(s)
            sg.expand_smx(s)
        print("</table><pre>")
        status.in_table = False
        print()

    sg_type = sg.type()
    show_group_generic(sg_type, status)

    if (inp.convention == "Hall" or len(inp.shelx_latt) != 0
            or len(inp.symxyz) != 0):
        symbols_match = sg.match_tabulated_settings()
        if (symbols_match.number() != 0):
            if (symbols_inp is None or symbols_inp.universal_hermann_mauguin()
                    != symbols_match.universal_hermann_mauguin()):
                print("Symmetry operations match:")
                show_symbols(symbols_match)
                print()
            else:
                print("Additional symmetry operations are redundant.")
                print()
        else:
            print("Space group number:", sg_type.number())
            print("Conventional Hermann-Mauguin symbol:", \
              sgtbx.space_group_symbols(sg_type.number()) \
              .universal_hermann_mauguin())
            print("Universal    Hermann-Mauguin symbol:", \
              sg_type.universal_hermann_mauguin_symbol())
            print("Hall symbol:", sg_type.hall_symbol())
            print("Change-of-basis matrix:", sg_type.cb_op().c())
            print("               Inverse:", sg_type.cb_op().c_inv())
            print()

    wyckoff_table = sgtbx.wyckoff_table(sg_type)
    print("List of Wyckoff positions:")
    print("</pre><table border=2 cellpadding=2>")
    status.in_table = True
    print("<tr>")
    print("<th>Wyckoff letter")
    print("<th>Multiplicity")
    print("<th>Site symmetry<br>point group type")
    print("<th>Representative special position operator")
    print("</tr>")
    for i_position in range(wyckoff_table.size()):
        position = wyckoff_table.position(i_position)
        print("<tr>")
        print("<td>%s<td>%d<td>%s<td><tt>%s</tt>" %
              (position.letter(), position.multiplicity(),
               position.point_group_type(),
               str(position.special_op_simplified())))
        print("</tr>")
    print("</table><pre>")
    status.in_table = False
    print()

    print("Harker planes:")
    print("</pre><table border=2 cellpadding=2>")
    status.in_table = True
    print("<tr>")
    print("<th>Algebraic")
    print("<th>Normal vector")
    print("<th>A point in the plane")
    print("</tr>")
    planes = harker.planes_fractional(sg)
    for plane in planes.list:
        print("<tr>")
        print("<td><tt>%s</tt><td>%s<td>%s" %
              (plane.algebraic(), str_ev(plane.n), str(plane.p)))
        print("</tr>")
    print("</table><pre>")
    status.in_table = False
    print()

    print("Additional generators of Euclidean normalizer:")
    ss = sgtbx.structure_seminvariants(sg)
    ss_vm = ss.vectors_and_moduli()
    print("  Number of structure-seminvariant vectors and moduli:", len(ss_vm))
    if (len(ss_vm)):
        print("    Vector    Modulus")
        for vm in ss_vm:
            print("   ", vm.v, vm.m)
    k2l = sg_type.addl_generators_of_euclidean_normalizer(True, False)
    l2n = sg_type.addl_generators_of_euclidean_normalizer(False, True)
    if (len(k2l)):
        print("  Inversion through a centre at:", end=' ')
        assert len(k2l) == 1
        print(sgtbx.translation_part_info(k2l[0]).origin_shift())
    if (len(l2n)):
        print("  Further generators:")
        print("</pre><table border=2 cellpadding=2>")
        status.in_table = True
        rt_mx_analysis_header()
        for s in l2n:
            rt_mx_analysis(s)
        print("</table><pre>")
        status.in_table = False
    print()

    print("Grid factors implied by symmetries:")
    grid_sg = sg.gridding()
    grid_ss = ss.gridding()
    eucl_sg = sg_type.expand_addl_generators_of_euclidean_normalizer(
        True, True)
    grid_eucl = eucl_sg.refine_gridding(grid_ss)
    print("  Space group:", grid_sg)
    print("  Structure-seminvariant vectors and moduli:", grid_ss)
    print("  Euclidean normalizer:", grid_eucl)
    print()
    print("  All points of a grid over the unit cell are mapped")
    print("  exactly onto other grid points only if the factors")
    print("  shown above are factors of the grid.")
    print()

    print("</pre>")
Example #8
0
            symbols_inp = None
            inp.convention = "Hall"
        else:
            print "Result of symbol lookup:"
            show_symbols(symbols_inp)
            print

    try:
        ps = sgtbx.parse_string(hall_symbol)
        sg = sgtbx.space_group(ps)
    except RuntimeError, e:
        print "--&gt;" + ps.string() + "&lt;--"
        print("-" * (ps.where() + 3)) + "^"
        raise

    io_utils.show_input_symbol(inp.sgsymbol, inp.convention)
    if (len(inp.shelx_latt) != 0):
        for n_fld in inp.shelx_latt:
            expand_shelx_latt(sg, n_fld)

    if (len(inp.symxyz) != 0):
        print "Addition of symmetry operations:"
        print "</pre><table border=2 cellpadding=2>"
        status.in_table = True
        rt_mx_analysis_header()
        for s in inp.symxyz:
            ps = sgtbx.parse_string(s)
            try:
                s = sgtbx.rt_mx(ps)
            except RuntimeError, e:
                print "</table><pre>"