Beispiel #1
0
    def count_atoms(selection="(all)",quiet=1,state=0,domain='',_self=cmd):
        '''
DESCRIPTION

    "count_atoms" returns a count of atoms in a selection.

USAGE

    count_atoms (selection)

PYMOL API

    cmd.count_atoms(string selection)

        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)   
            r = _cmd.select(_self._COb,"_count_tmp","("+str(selection)+")",1,int(state)-1,str(domain))
            _cmd.delete(_self._COb,"_count_tmp")
        finally:
            _self.unlock(r,_self)
        if not quiet: print " count_atoms: %d atoms"%r
        if _raising(r,_self): raise pymol.CmdException
        return r
Beispiel #2
0
    def count_atoms(selection="(all)", quiet=1, state=0, domain='', _self=cmd):
        '''
DESCRIPTION

    "count_atoms" returns a count of atoms in a selection.

USAGE

    count_atoms (selection)

PYMOL API

    cmd.count_atoms(string selection)

        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)
            r = _cmd.select(_self._COb, "_count_tmp",
                            "(" + str(selection) + ")", 1,
                            int(state) - 1, str(domain))
            _cmd.delete(_self._COb, "_count_tmp")
        finally:
            _self.unlock(r, _self)
        if not quiet: print " count_atoms: %d atoms" % r
        if _raising(r, _self): raise pymol.CmdException
        return r
Beispiel #3
0
    def delete(name, _self=cmd):
        '''
DESCRIPTION

    "delete" removes an object or a selection. 

USAGE

    delete name  
    delete all   # deletes all objects

    name = name of object or selection

PYMOL API

    cmd.delete (string name = object-or-selection-name )

SEE ALSO

    remove
        '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.delete(_self._COb, str(name))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Beispiel #4
0
    def delete(name,_self=cmd):
        '''
DESCRIPTION

    "delete" removes an object or a selection. 

USAGE

    delete name  
    delete all   # deletes all objects

    name = name of object or selection

PYMOL API

    cmd.delete (string name = object-or-selection-name )

SEE ALSO

    remove
        '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)   
            r = _cmd.delete(_self._COb,str(name))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException      
        return r