예제 #1
0
def test():
    test1 = tmp_out()
    show_cosets.run("P3", "P622", out=test1)
    assert test1.store == expected_output_test1

    test2 = tmp_out()
    show_cosets.run("P2", "P3", out=test2)
    assert test2.store == expected_output_test2
    print("OK")
예제 #2
0
def create_all_subgroups( sg1,show_all=True, reverse=False ):
  sg_high = sgtbx.space_group_info( sg1  ).group()
  sg_low  = sgtbx.space_group_info( "p1" ).group()
  graph_object =  pointgroup_tools.point_group_graph( sg_low, sg_high, False,True)
  highest_sg = str( sgtbx.space_group_info( sg1  ) )
  rev_dict = reverse_dict( graph_object.graph.o )
  maximal_subgroups = get_maximal_subgroup( highest_sg, rev_dict )
  if show_all:
    print "Subgroups of input space groups which can be constructed by introducing one single operator (and group completion) in the subgroup:"
    for sg in rev_dict[ highest_sg ]:
      line = "       "
      line += sg+(30-len(sg))*" "+str(graph_object.graph.edge_objects[ sg ][highest_sg])+(90-len( str(graph_object.graph.edge_objects[ sg ][highest_sg]) ))*" "
      print line

    print
    print "Maximal subgroup detected in the full sub-group-graph: "
    for sg in maximal_subgroups:
      line = "       "
      line += sg
      print line

    print
    print
    print
    print " Cosets for each maximal sub-group and the input space group are listed:"
    for sg in maximal_subgroups:
      print "-----------------------------------------------------------------"
      show_cosets.run( sg,highest_sg )
      print "-----------------------------------------------------------------"
      print
      print
      print
      print

  else:
    print "Maximal subgroups of %s: "%(sg1)
    for sg in maximal_subgroups:
      line = "       "
      line += sg
      print line
    print
    print
    print

  if reverse:
    print "Minimal supergroups generated by the sub-groups of the input space group:"
    tmp_sg = sgtbx.space_group_info( sg1 )
    for sg in maximal_subgroups:
      tmp_sgsg = sgtbx.space_group_info( sg )
      cb_op = tmp_sgsg.change_of_basis_op_to_reference_setting()
      okai=False
      try:
        new_sg = tmp_sg.change_basis( cb_op )
        okai=True
        print new_sg ," is a minimal supergroup of ", tmp_sgsg.change_basis(cb_op)
      except Exception: pass
      if not okai:
        print "%s (%s) is a minimal supergroup of %s     [*]"%(tmp_sg,cb_op, tmp_sgsg.change_basis(cb_op))
    print
    print
    print