コード例 #1
0
ファイル: Selection.py プロジェクト: djay0529/mdanalysis
    def _apply_KDTree(self, group):
        """Selection using KDTree but periodic = True not supported.
        (KDTree routine is ca 15% slower than the distance matrix one)
        """
        sys_indices = numpy.array([a.number for a in self._group_atoms_list])
        sys_coor = Selection.coord[sys_indices]
        if self.periodic:
            pass  # or warn? -- no periodic functionality with KDTree search
        from MDAnalysis.KDTree.NeighborSearch import CoordinateNeighborSearch

        CNS = CoordinateNeighborSearch(sys_coor)  # cache the KDTree for this selection/frame?
        found_indices = CNS.search(self.ref, self.cutoff)
        res_atoms = [self._group_atoms_list[i] for i in found_indices]  # make list numpy array and use fancy indexing?
        return set(res_atoms)
コード例 #2
0
ファイル: Selection.py プロジェクト: ivirshup/mdanalysis
    def _apply_KDTree(self, group):
        """Selection using KDTree but periodic = True not supported.
        (KDTree routine is ca 15% slower than the distance matrix one)
        """
        sys_indices = numpy.array([a.number for a in self._group_atoms_list])
        sys_coor = Selection.coord[sys_indices]
        if self.periodic:
            pass  # or warn? -- no periodic functionality with KDTree search
        from MDAnalysis.KDTree.NeighborSearch import CoordinateNeighborSearch

        CNS = CoordinateNeighborSearch(
            sys_coor)  # cache the KDTree for this selection/frame?
        found_indices = CNS.search(self.ref, self.cutoff)
        res_atoms = [self._group_atoms_list[i] for i in found_indices
                     ]  # make list numpy array and use fancy indexing?
        return set(res_atoms)
コード例 #3
0
ファイル: Selection.py プロジェクト: djay0529/mdanalysis
    def _apply_KDTree(self, group):
        """Selection using KDTree but periodic = True not supported.
        (KDTree routine is ca 15% slower than the distance matrix one)
        """
        sys_indices = numpy.array([a.number for a in self._group_atoms_list])
        sys_coor = Selection.coord[sys_indices]
        sel_atoms = self.sel._apply(group)  # group is wrong, should be universe (?!)
        sel_CoG = AtomGroup(sel_atoms).centerOfGeometry()
        self.ref = numpy.array((sel_CoG[0], sel_CoG[1], sel_CoG[2]))
        if self.periodic:
            pass  # or warn? -- no periodic functionality with KDTree search
        from MDAnalysis.KDTree.NeighborSearch import CoordinateNeighborSearch

        CNS = CoordinateNeighborSearch(sys_coor)  # cache the KDTree for this selection/frame?
        found_ExtIndices = CNS.search(self.ref, self.exRadius)
        found_IntIndices = CNS.search(self.ref, self.inRadius)
        found_indices = list(set(found_ExtIndices) - set(found_IntIndices))
        res_atoms = [self._group_atoms_list[i] for i in found_indices]
        return set(res_atoms)
コード例 #4
0
ファイル: Selection.py プロジェクト: ivirshup/mdanalysis
    def _apply_KDTree(self, group):
        """Selection using KDTree but periodic = True not supported.
        (KDTree routine is ca 15% slower than the distance matrix one)
        """
        sys_indices = numpy.array([a.number for a in self._group_atoms_list])
        sys_coor = Selection.coord[sys_indices]
        sel_atoms = self.sel._apply(
            group)  # group is wrong, should be universe (?!)
        sel_CoG = AtomGroup(sel_atoms).centerOfGeometry()
        self.ref = numpy.array((sel_CoG[0], sel_CoG[1], sel_CoG[2]))
        if self.periodic:
            pass  # or warn? -- no periodic functionality with KDTree search
        from MDAnalysis.KDTree.NeighborSearch import CoordinateNeighborSearch

        CNS = CoordinateNeighborSearch(
            sys_coor)  # cache the KDTree for this selection/frame?
        found_ExtIndices = CNS.search(self.ref, self.exRadius)
        found_IntIndices = CNS.search(self.ref, self.inRadius)
        found_indices = list(set(found_ExtIndices) - set(found_IntIndices))
        res_atoms = [self._group_atoms_list[i] for i in found_indices]
        return set(res_atoms)