def run(args):
  if (len(args) == 0): args = ["--help"]
  command_line = (option_parser(
    usage="%s [OPTIONS] FILE..." % libtbx.env.dispatcher_name)
    .option(None, "--niggli_cell",
      action="store_true")
  ).process(args=args)
  if (len(command_line.args) == 0):
    command_line.parser.show_help()
    return
  co = command_line.options
  for arg in command_line.args:
    crystal_symmetry = crystal_symmetry_from_any.extract_from(arg)
    if (crystal_symmetry is None):
      raise RuntimeError, \
        "Unknown file format or unit cell and space group missing from file."
    if (co.niggli_cell
          and crystal_symmetry.unit_cell() is not None
          and crystal_symmetry.space_group_info() is not None):
      crystal_symmetry = crystal_symmetry.niggli_cell()
    format.crystal_symmetry(crystal_symmetry)
    print
    print "\n".join(
      crystal_symmetry_as_cns_inp_defines(crystal_symmetry=crystal_symmetry))
    print
    print format_cryst1_and_scale_records(
      crystal_symmetry=crystal_symmetry,
      write_scale_records=True)
    print
예제 #2
0
def run(args):
    if (len(args) == 0): args = ["--help"]
    command_line = (option_parser(usage="%s [OPTIONS] FILE..." %
                                  libtbx.env.dispatcher_name).option(
                                      None,
                                      "--niggli_cell",
                                      action="store_true")).process(args=args)
    if (len(command_line.args) == 0):
        command_line.parser.show_help()
        return
    co = command_line.options
    for arg in command_line.args:
        crystal_symmetry = crystal_symmetry_from_any.extract_from(arg)
        if (crystal_symmetry is None):
            raise RuntimeError, \
              "Unknown file format or unit cell and space group missing from file."
        if (co.niggli_cell and crystal_symmetry.unit_cell() is not None
                and crystal_symmetry.space_group_info() is not None):
            crystal_symmetry = crystal_symmetry.niggli_cell()
        format.crystal_symmetry(crystal_symmetry)
        print
        print "\n".join(
            crystal_symmetry_as_cns_inp_defines(
                crystal_symmetry=crystal_symmetry))
        print
        print format_cryst1_and_scale_records(
            crystal_symmetry=crystal_symmetry, write_scale_records=True)
        print
예제 #3
0
 def SaveSites (self, file_name) :
   if (self._atoms is None) or (len(self._atoms) == 0) :
     raise Sorry("No atoms loaded!")
   from scitbx.array_family import flex
   selection = flex.bool(self._atoms.size(), False)
   assert (len(selection) == self.GetItemCount())
   for item in range(self.GetItemCount()) :
     if (self.IsChecked(item)) :
       selection[item] = True
   atoms_selected = self._atoms.select(selection)
   if (len(atoms_selected) == 0) :
     raise Sorry("No atoms selected!")
   f = open(file_name, "w")
   if (self._symm is not None) :
     from iotbx.pdb import format_cryst1_and_scale_records
     f.write(format_cryst1_and_scale_records(self._symm) + "\n")
   for atom in atoms_selected :
     f.write(atom.format_atom_record() + "\n")
   f.close()
   wx.MessageBox(("%d atoms saved to %s.") % (len(atoms_selected), file_name))