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>" # 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>"
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) 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>"
def run(server_info, inp, status): print("<pre>") unit_cell = uctbx.unit_cell(inp.ucparams) unit_cell.show_parameters() print() if (inp.coor_type == "Fractional"): print("Cartesian coordinates:") else: print("Fractional 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"): c = unit_cell.orthogonalize(coordinates) else: c = unit_cell.fractionalize(coordinates) print(skipped, "%.6g %.6g %.6g" % tuple(c)) print("</pre>")
def run(server_info, inp, status): print "<pre>" unit_cell = uctbx.unit_cell(inp.ucparams) unit_cell.show_parameters() print if (inp.coor_type == "Fractional"): print "Cartesian coordinates:" else: print "Fractional 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"): c = unit_cell.orthogonalize(coordinates) else: c = unit_cell.fractionalize(coordinates) print skipped, "%.6g %.6g %.6g" % tuple(c) print "</pre>"
def run(server_info, inp, status): print "<pre>" unit_cell_old = uctbx.unit_cell(inp.ucparams_old) print "Old symmetry:" print " ", unit_cell_old.show_parameters() space_group_info_old = sgtbx.space_group_info( symbol=inp.sgsymbol_old, table_id=inp.convention_old) print " ", space_group_info_old.show_summary() print if (len(inp.sgsymbol_new.strip()) == 0): space_group_info_new = space_group_info_old.reference_setting() inp.convention_new = "" else: space_group_info_new = sgtbx.space_group_info( symbol=inp.sgsymbol_new, table_id=inp.convention_new) print "New space group symbol:" print " ", space_group_info_new.show_summary() print if ( space_group_info_new.type().number() != space_group_info_old.type().number()): print "Space group numbers are not equal!" else: c = space_group_info_new.type().cb_op().c_inv().multiply( space_group_info_old.type().cb_op().c()).new_denominators( sgtbx.cb_r_den, sgtbx.cb_t_den) cb_op = sgtbx.change_of_basis_op(c) print "Change-of-basis matrix:", cb_op.c() print " Inverse:", cb_op.c_inv() print assert space_group_info_old.group().is_compatible_unit_cell(unit_cell_old) unit_cell_new = unit_cell_old.change_basis(cb_op=cb_op) print "New unit cell parameters:" print " ", unit_cell_new.show_parameters() assert space_group_info_new.group().is_compatible_unit_cell(unit_cell_new) 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 = unit_cell_old.fractionalize(coordinates) new_coordinates = cb_op(coordinates) if (inp.coor_type != "Fractional"): new_coordinates = unit_cell_new.orthogonalize(new_coordinates) print skipped, "%.6g %.6g %.6g" % tuple(new_coordinates) print "</pre>"
def run(server_info, inp, status): print "<pre>" unit_cell_old = uctbx.unit_cell(inp.ucparams_old) print "Old symmetry:" print " ", unit_cell_old.show_parameters() space_group_info_old = sgtbx.space_group_info(symbol=inp.sgsymbol_old, table_id=inp.convention_old) print " ", space_group_info_old.show_summary() print if (len(inp.sgsymbol_new.strip()) == 0): space_group_info_new = space_group_info_old.reference_setting() inp.convention_new = "" else: space_group_info_new = sgtbx.space_group_info( symbol=inp.sgsymbol_new, table_id=inp.convention_new) print "New space group symbol:" print " ", space_group_info_new.show_summary() print if (space_group_info_new.type().number() != space_group_info_old.type().number()): print "Space group numbers are not equal!" else: c = space_group_info_new.type().cb_op().c_inv().multiply( space_group_info_old.type().cb_op().c()).new_denominators( sgtbx.cb_r_den, sgtbx.cb_t_den) cb_op = sgtbx.change_of_basis_op(c) print "Change-of-basis matrix:", cb_op.c() print " Inverse:", cb_op.c_inv() print assert space_group_info_old.group().is_compatible_unit_cell( unit_cell_old) unit_cell_new = unit_cell_old.change_basis(cb_op=cb_op) print "New unit cell parameters:" print " ", unit_cell_new.show_parameters() assert space_group_info_new.group().is_compatible_unit_cell( unit_cell_new) 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 = unit_cell_old.fractionalize(coordinates) new_coordinates = cb_op(coordinates) if (inp.coor_type != "Fractional"): new_coordinates = unit_cell_new.orthogonalize(new_coordinates) print skipped, "%.6g %.6g %.6g" % tuple(new_coordinates) print "</pre>"