Exemple #1
0
    def __init__(self, args):
        n = tst_tardy.n_test_models
        command_line = (
            libtbx_option_parser(
                usage="""\
scitbx.python wx_tardy.py [options] model_index
  model_index range: 0 ... %d\
"""
                % (n - 1)
            )
            .option(
                None, "--fixed_vertices", type="str", action="append", default=None, metavar="COMMA-SEPARATED-INTEGERS"
            )
            .option(None, "--i_seq_labels", action="store_true", default=False)
            .option(None, "--velocity_scaling", action="store_true", default=False)
            .option(None, "--e_kin_per_dof", type="float", default=1.0, metavar="FLOAT")
            .option(None, "--view_scale", type="float", default=1.3, metavar="FLOAT")
        ).process(args=args, nargs=1)
        co = command_line.options
        self.fixed_vertex_lists = []
        if co.fixed_vertices is not None:
            for s in co.fixed_vertices:
                self.fixed_vertex_lists.append(tuple(eval("[" + s + "]")))
        self.i_seq_labels = co.i_seq_labels
        self.velocity_scaling = co.velocity_scaling
        self.e_kin_per_dof = co.e_kin_per_dof
        self.view_scale = co.view_scale
        self.model_index = int(command_line.args[0])
        assert 0 <= self.model_index < n
        super(App, self).__init__(title="wx_tardy")
def run(args):
  if (len(args) == 0): args = ["--help"]
  from libtbx.option_parser import libtbx_option_parser
  import libtbx.load_env
  command_line = (libtbx_option_parser(
    usage="%s [options] space_group_symbol ..." % libtbx.env.dispatcher_name)
      .option(None, "--primitive",
        action="store_true",
        help="Convert centred space groups to primitive setting.")
      .option(None, "--symops",
        action="store_true",
        help="Show list of symmetry operations.")
  ).process(args=args)
  co = command_line.options
  from cctbx import sgtbx
  args = command_line.args
  if (args == ["all"]):
    args = [str(no) for no in xrange(1,230+1)]
  for symbol in args:
    sgi = sgtbx.space_group_info(symbol=symbol)
    if (co.primitive):
      sgi = sgi.primitive_setting()
    sgi.show_summary()
    gr = sgi.group()
    print "  Crystal system:", gr.crystal_system()
    print "  Point group type:", gr.point_group_type()
    print "  Laue group type:", gr.laue_group_type()
    print "  Number of symmetry operations:", gr.order_z()
    print "  Lattice centering operations:", gr.n_ltr()
    if (gr.n_ltr() != 1):
      print "  Number of symmetry operations in primitive setting:", \
        gr.order_p()
    if (gr.is_centric()): s = gr(0, 1, 0)
    else:                 s = None
    print "  Center of inversion:", s
    print "  Dimensionality of continuous allowed origin shifts:", \
      sgi.number_of_continuous_allowed_origin_shifts()
    ssi_vm = sgi.structure_seminvariants().vectors_and_moduli()
    print "  Structure-seminvariant vectors and moduli:", \
      len(ssi_vm)
    if (len(ssi_vm) != 0):
      for vm in ssi_vm:
        print "    (%2d, %2d, %2d)" % vm.v, "%2d" % vm.m
    print "  Direct-space asymmetric unit:"
    dau = sgi.direct_space_asu()
    print "    Number of faces: %d" % len(dau.cuts)
    for cut in dau.cuts:
      print "    " + cut.as_xyz()
    print "  ADP constraint matrix:"
    _ = sgi.group().adp_constraints().gradient_sum_matrix()
    from scitbx import matrix
    print matrix.rec(tuple(_), _.focus()).mathematica_form(
      one_row_per_line=True,
      prefix="    ")
    if (co.symops):
      print "  List of symmetry operations:"
      for s in sgi.group():
        print "    %s" % str(s)
    print
 def __init__(O, args):
     import libtbx.load_env
     command_line = (libtbx_option_parser(
         usage="%s [options] pdb_file" % libtbx.env.dispatcher_name
     ).option(
         None,
         "--model_id",
         action="store",
         type="str",
         default=None,
         help="only show model with given id",
         metavar="STR"
     ).option(
         None,
         "--labels_threshold",
         action="store",
         type="int",
         default=20,
         help="do not show atom labels if more than given number of atoms",
         metavar="INT").option(None,
                               "--serial_labels",
                               action="store_true",
                               default=False)).process(args=args, nargs=1)
     O.co = command_line.options
     file_name = command_line.args[0]
     import iotbx.pdb
     O.pdb_inp = iotbx.pdb.input(file_name=file_name)
     O.pdb_hierarchy = O.pdb_inp.construct_hierarchy()
     O.pdb_atoms = O.pdb_hierarchy.atoms()
     print(file_name)
     print("  number of models:", O.pdb_hierarchy.models_size())
     print("  number of atoms:", O.pdb_atoms.size())
     if (O.co.model_id is not None):
         mid = O.co.model_id.strip()
         from libtbx.str_utils import show_string
         print("Selecting model with id %s" % show_string(mid))
         for mdl in O.pdb_hierarchy.models():
             if (mdl.id.strip() == mid):
                 O.pdb_hierarchy = iotbx.pdb.hierarchy.root()
                 O.pdb_hierarchy.append_model(mdl)
                 O.pdb_atoms = O.pdb_hierarchy.atoms()
                 print("  number of atoms:", O.pdb_atoms.size())
                 break
         else:
             raise RuntimeError("--model-id=%s is not in the pdb file." %
                                show_string(mid))
     super(App, O).__init__(title=libtbx.env.dispatcher_name)
 def __init__(O, args):
   import libtbx.load_env
   command_line = (libtbx_option_parser(
     usage="%s [options] pdb_file" % libtbx.env.dispatcher_name)
     .option(None, "--model_id",
       action="store",
       type="str",
       default=None,
       help="only show model with given id",
       metavar="STR")
     .option(None, "--labels_threshold",
       action="store",
       type="int",
       default=20,
       help="do not show atom labels if more than given number of atoms",
       metavar="INT")
     .option(None, "--serial_labels",
       action="store_true",
       default=False)
   ).process(args=args, nargs=1)
   O.co = command_line.options
   file_name = command_line.args[0]
   import iotbx.pdb
   O.pdb_inp = iotbx.pdb.input(file_name=file_name)
   O.pdb_hierarchy = O.pdb_inp.construct_hierarchy()
   O.pdb_atoms = O.pdb_hierarchy.atoms()
   print file_name
   print "  number of models:", O.pdb_hierarchy.models_size()
   print "  number of atoms:", O.pdb_atoms.size()
   if (O.co.model_id is not None):
     mid = O.co.model_id.strip()
     from libtbx.str_utils import show_string
     print "Selecting model with id %s" % show_string(mid)
     for mdl in O.pdb_hierarchy.models():
       if (mdl.id.strip() == mid):
         O.pdb_hierarchy = iotbx.pdb.hierarchy.root()
         O.pdb_hierarchy.append_model(mdl)
         O.pdb_atoms = O.pdb_hierarchy.atoms()
         print "  number of atoms:", O.pdb_atoms.size()
         break
     else:
       raise RuntimeError(
         "--model-id=%s is not in the pdb file." % show_string(mid))
   super(App, O).__init__(title=libtbx.env.dispatcher_name)
Exemple #5
0
    def __init__(self, args):
        n = tst_tardy.n_test_models
        command_line = (libtbx_option_parser(usage="""\
scitbx.python wx_tardy.py [options] model_index
  model_index range: 0 ... %d\
""" % (n - 1)).option(None,
                      "--fixed_vertices",
                      type="str",
                      action="append",
                      default=None,
                      metavar="COMMA-SEPARATED-INTEGERS").option(
                          None,
                          "--i_seq_labels",
                          action="store_true",
                          default=False).option(
                              None,
                              "--velocity_scaling",
                              action="store_true",
                              default=False).option(
                                  None,
                                  "--e_kin_per_dof",
                                  type="float",
                                  default=1.0,
                                  metavar="FLOAT").option(
                                      None,
                                      "--view_scale",
                                      type="float",
                                      default=1.3,
                                      metavar="FLOAT")).process(args=args,
                                                                nargs=1)
        co = command_line.options
        self.fixed_vertex_lists = []
        if (co.fixed_vertices is not None):
            for s in co.fixed_vertices:
                self.fixed_vertex_lists.append(tuple(eval("[" + s + "]")))
        self.i_seq_labels = co.i_seq_labels
        self.velocity_scaling = co.velocity_scaling
        self.e_kin_per_dof = co.e_kin_per_dof
        self.view_scale = co.view_scale
        self.model_index = int(command_line.args[0])
        assert 0 <= self.model_index < n
        super(App, self).__init__(title="wx_tardy")
Exemple #6
0
def run(args):
    if (len(args) == 0): args = ["--help"]
    from libtbx.option_parser import libtbx_option_parser
    import libtbx.load_env
    command_line = (libtbx_option_parser(
        usage="%s [options] space_group_symbol ..." %
        libtbx.env.dispatcher_name).option(
            None,
            "--primitive",
            action="store_true",
            help="Convert centred space groups to primitive setting.").option(
                None,
                "--symops",
                action="store_true",
                help="Show list of symmetry operations.")).process(args=args)
    co = command_line.options
    from cctbx import sgtbx
    args = command_line.args
    if (args == ["all"]):
        args = [str(no) for no in xrange(1, 230 + 1)]
    for symbol in args:
        sgi = sgtbx.space_group_info(symbol=symbol)
        if (co.primitive):
            sgi = sgi.primitive_setting()
        sgi.show_summary()
        gr = sgi.group()
        print "  Crystal system:", gr.crystal_system()
        print "  Point group type:", gr.point_group_type()
        print "  Laue group type:", gr.laue_group_type()
        print "  Number of symmetry operations:", gr.order_z()
        print "  Lattice centering operations:", gr.n_ltr()
        if (gr.n_ltr() != 1):
            print "  Number of symmetry operations in primitive setting:", \
              gr.order_p()
        if (gr.is_centric()): s = gr(0, 1, 0)
        else: s = None
        print "  Center of inversion:", s
        print "  Dimensionality of continuous allowed origin shifts:", \
          sgi.number_of_continuous_allowed_origin_shifts()
        ssi_vm = sgi.structure_seminvariants().vectors_and_moduli()
        print "  Structure-seminvariant vectors and moduli:", \
          len(ssi_vm)
        if (len(ssi_vm) != 0):
            for vm in ssi_vm:
                print "    (%2d, %2d, %2d)" % vm.v, "%2d" % vm.m
        print "  Direct-space asymmetric unit:"
        dau = sgi.direct_space_asu()
        print "    Number of faces: %d" % len(dau.cuts)
        for cut in dau.cuts:
            print "    " + cut.as_xyz()
        print "  ADP constraint matrix:"
        _ = sgi.group().adp_constraints().gradient_sum_matrix()
        from scitbx import matrix
        print matrix.rec(tuple(_),
                         _.focus()).mathematica_form(one_row_per_line=True,
                                                     prefix="    ")
        if (co.symops):
            print "  List of symmetry operations:"
            for s in sgi.group():
                print "    %s" % str(s)
        print