コード例 #1
0
 def get_symops_from_supergroup_that_are_not_in_subgroup(self, sg_high):
     coset = cosets.left_decomposition(g=sg_high, h=self.sg_low)
     for set in coset.partitions[1:]:
         if self.enforce_point_groups:
             if set[0].r().determinant() > 0:
                 self.symops.append(set[0])
         else:
             self.symops.append(set[0])
コード例 #2
0
 def get_symops_from_supergroup_that_are_not_in_subgroup(self, sg_high):
   coset = cosets.left_decomposition(g=sg_high,
                                     h=self.sg_low)
   for set in coset.partitions[1:]:
     if self.enforce_point_groups:
       if set[0].r().determinant()>0:
         self.symops.append(set[0])
     else:
       self.symops.append(set[0])
コード例 #3
0
def coset_lookup(pg_low, pg_high):
    coset = cosets.left_decomposition(g=pg_high, h=pg_low)
    full_cosets = []

    for set in coset.partitions:
        if (set[0].r().determinant() > 0):
            tmp = []
            for symop in set:
                tmp.append(symop.r().as_hkl())
            full_cosets.append(tmp)
    return full_cosets
コード例 #4
0
def coset_lookup(pg_low,
                 pg_high):
  coset = cosets.left_decomposition(g=pg_high,
                                    h=pg_low)
  full_cosets = []

  for set in coset.partitions:
    if (set[0].r().determinant()>0):
      tmp = []
      for symop in set:
        tmp.append(symop.r().as_hkl())
      full_cosets.append(tmp)
  return full_cosets
コード例 #5
0
ファイル: show_cosets.py プロジェクト: cctbx/cctbx-playground
def run(g,h,out=None):
  if out is None:
    out = sys.stdout

  g = sgtbx.space_group_info( g ).group()
  h = sgtbx.space_group_info( h ).group()

  success = False
  try:
    cc = cosets.left_decomposition( h,g)
    cc.show(out=out)
    success = True
  except Exception: pass

  if not success:
    print >> out, "Coset decomposition not successfull."
    print >> out, "Group %s might not be a subgroup of %s"%(sgtbx.space_group_info( group=g ), sgtbx.space_group_info( group=h )   )
    print >> out, "Sorry....."
コード例 #6
0
ファイル: show_cosets.py プロジェクト: zhuligs/cctbx_project
def run(g, h, out=None):
    if out is None:
        out = sys.stdout

    g = sgtbx.space_group_info(g).group()
    h = sgtbx.space_group_info(h).group()

    success = False
    try:
        cc = cosets.left_decomposition(h, g)
        cc.show(out=out)
        success = True
    except Exception:
        pass

    if not success:
        print >> out, "Coset decomposition not successfull."
        print >> out, "Group %s might not be a subgroup of %s" % (
            sgtbx.space_group_info(group=g), sgtbx.space_group_info(group=h))
        print >> out, "Sorry....."
コード例 #7
0
ファイル: __init__.py プロジェクト: kek-pf-mx/dials
    def cluster_analysis(self):
        from cctbx.sgtbx import cosets

        if self.params.cluster.method == 'dbscan':
            self.dbscan_clustering()
        elif self.params.cluster.method == 'bisect':
            self.bisect_clustering()
        elif self.params.cluster.method == 'minimize_divide':
            self.minimize_divide_clustering()
        elif self.params.cluster.method == 'agglomerative':
            self.agglomerative_clustering()
        elif self.params.cluster.method == 'seed':
            self.seed_clustering()

        # Number of clusters in labels, ignoring noise if present.
        n_clusters = len(set(
            self.cluster_labels)) - (1 if -1 in self.cluster_labels else 0)

        cluster_miller_arrays = []

        space_groups = []

        sym_ops = [
            sgtbx.rt_mx(s).new_denominators(1, 12)
            for s in self.target.get_sym_ops()
        ]
        self.space_groups = space_groups

        reindexing_ops = {}
        space_groups = {}

        for dataset_id in range(len(self.datasets)):
            sg = copy.deepcopy(self.input_space_group)
            ref_sym_op_id = None
            ref_cluster_id = None
            for sym_op_id in range(len(sym_ops)):
                i_cluster = self.cluster_labels[len(self.datasets) * sym_op_id
                                                + dataset_id]
                if i_cluster < 0:
                    continue
                if ref_sym_op_id is None:
                    ref_sym_op_id = sym_op_id
                    ref_cluster_id = i_cluster
                    continue
                op = sym_ops[ref_sym_op_id].inverse().multiply(
                    sym_ops[sym_op_id])
                if i_cluster == ref_cluster_id:
                    sg.expand_smx(op.new_denominators(1, 12))

            sg.make_tidy()
            space_groups[dataset_id] = sg

            coset = cosets.left_decomposition(
                self.target._lattice_group,
                sg.info().primitive_setting().group())

            reindexing_ops[dataset_id] = {}

            for i_cluster in range(n_clusters):
                isel = (self.cluster_labels == i_cluster).iselection()
                dataset_ids = isel % len(self.datasets)
                idx = flex.first_index(dataset_ids, dataset_id)
                sel = (dataset_ids == dataset_id).iselection()
                if idx >= 0:
                    sym_op_id = isel[idx] // len(self.datasets)
                for s in sel:
                    sym_op_id = isel[s] // len(self.datasets)

                    for partition in coset.partitions:
                        if sym_ops[sym_op_id] in partition:
                            if i_cluster not in reindexing_ops[dataset_id]:
                                reindexing_ops[dataset_id][
                                    i_cluster] = partition[0].as_xyz()
                            #else:
                            #assert reindexing_ops[dataset_id][i_cluster] == partition[0].as_xyz()

        self.space_groups = space_groups
        self.reindexing_ops = reindexing_ops