Beispiel #1
0
    def do_select(self, name):

        if self.pick_count < 1:
            self.atom1 = self.get_Atom(name)

            if len(self.atom1) > 0:
                if int(self.atom1[2]) == self.ResSeq and self.atom1[1] == 'LIG':
                    self.pickNextAtom()
                    self.highlight_Atom(self.atom1)
                else:
                    self.ErrorStatus = [ "You can only select atoms from the object " + self.LigDisplay + ". Try again." ]
            else:
                self.ErrorStatus = [ "No atoms could be selected in the object " + self.LigDisplay + ". Try again." ]

        else:
            self.atom2 = self.get_Atom(name)

            if len(self.atom2) > 0:
                if int(self.atom2[2]) == self.ResSeq and self.atom2[1] == 'LIG':
                    self.pickNextAtom()
                    self.highlight_Atom(self.atom2)

                    if not self.is_Valid(self.atom1, self.atom2):
                        self.ErrorStatus = [ "The selected bond cannot be set as flexible. Try again." ]
                    else:
                        # Already existing Possible Bond
                        if self.FlexIndex != 0:
                            if self.dictFlexBonds[self.FlexIndex][0]:
                                self.dictFlexBonds[self.FlexIndex][0] = 0
                            else:
                                self.dictFlexBonds[self.FlexIndex][0] = 1

                        # Force new bond
                        else:
                            self.Force_NewBond(General_cmd.get_ID(self.atom1[0], self.LigDisplay), 
                                               General_cmd.get_ID(self.atom2[0], self.LigDisplay))

                    self.show_SelectedBonds()
                    self.pick_count = 0

                    cmd.refresh_wizard()
                    cmd.delete(self.AtomDisplay)                    
                    cmd.refresh()

                else:
                    self.ErrorStatus = [ "No atoms could be selected in the object " + self.LigDisplay + ". Try again." ]
            
            else:
                self.ErrorStatus = [ "You can only select atoms from the object " + self.LigDisplay + ". Try again." ]
Beispiel #2
0
    def is_Valid(self, atom1, atom2):

        # 2 hydrogens
        if atom1[4].strip()[0] == 'H' and atom2[4].strip()[0] == 'H':
            return 0
        # Distance is too far
        elif Geometry.distance(atom1[5:],atom2[5:]) > 2.0:
            return 0

        self.FlexIndex = self.is_Flexible(General_cmd.get_ID(atom1[0], self.LigDisplay), 
                                          General_cmd.get_ID(atom2[0], self.LigDisplay))

        # The bond cannot be defined
        if self.FlexIndex == -1:
            return 0
        # The bond can only be defined using force
        elif self.FlexIndex == 0 and not self.Force:
            return 0

        return 1
Beispiel #3
0
    def do_select(self, name):


        lt = cmd.index(name + ' &  !hydrogens')

        for t in lt:
            if t[0] != self.LigDisplay:
                self.ErrorStatus = [ "You can only select a non-Hydrogen from the object " + self.LigDisplay + ". Try again." ]
            else:
                self.AnchorAtom = General_cmd.get_ID(t[1],t[0])
                self.RefreshDisplay()
            break
        cmd.deselect()
Beispiel #4
0
    def do_select(self, name):

        lt = cmd.index(name + ' &  !hydrogens')

        for t in lt:
            if t[0] != self.LigDisplay:
                self.ErrorStatus = [
                    "You can only select a non-Hydrogen from the object " +
                    self.LigDisplay + ". Try again."
                ]
            else:
                self.AnchorAtom = General_cmd.get_ID(t[1], t[0])
                self.RefreshDisplay()
            break
        cmd.deselect()
Beispiel #5
0
    def get_Coords(self, atom_number, point):

        found = False

        try:
            atom_number = int(atom_number)

            atoms = cmd.get_model(self.LigDisplay, state=cmd.get_state())
            for at in atoms.atom:
                
                if General_cmd.get_ID(at.index, self.LigDisplay) == atom_number:
                    point.extend([at.coord[0],at.coord[1],at.coord[2]])
                    found = True
                    break

            if not found:
                return 1

        except:
            return 1

        return 0