Package Pmv :: Module editCommands :: Class AddHydrogensCommand
[hide private]
[frames] | no frames]

Class AddHydrogensCommand

source code

ViewerFramework.VFCommand.Command --+    
                                    |    
                  mvCommand.MVCommand --+
                                        |
                                       AddHydrogensCommand

This command adds hydrogen atoms to all atoms in all molecules that have at least one member (i.e atom, residue, chain, base-pair etc..) specified in the first argument.
    
Package:Pmv
    
Module :editCommands
    
Class:AddHydrogensCommand
    
Command:add_h
    
Synopsis:
 
        AtomSet<---add_h(nodes, polarOnly=0, method='noBondOrder,
                         renumber=1,**kw)

    
Required Arguments:

        nodes --- TreeNodeSet holding the current selection

        polarOnly --- default is 0

        method --- Hydrogen atoms can be added using 2 different methods, ex: method='withBondOrder', default is 'noBondOrder'

        renumber --- default is 1

Returns an atomSet containing the created H atoms

NOTE: This command adds hydrogens to all atoms in the molecule specified using the nodes argument.

The hydrogen atoms added to each molecule are also saved as a set called mol.name + '_addedH'

This class uses the AddHydrogens class from the PyBabel package.


Before this AddHydrogens object can be used, atoms must have been assigned
a type see (AtomHybridization in types.py).


Hydrogen atoms can be added using 2 different methods. The first one requires
bondOrders to have been calculated previousely.


example:


      >>> atype = AtomHybridization()

      >>> atype.assignHybridization(atoms)

      >>> addh = AddHydrogens()

      >>> hat = addh.addHydrogens(atoms)


      atoms has to be a list of atom objects

      Atom:

          a .coords : 3-sequence of floats

          a .bonds : list of Bond objects

          babel_type: string

          babel_atomic_number: int


      Bond:

          b .atom1 : instance of Atom

          b .atom2 : instance of Atom


      or

      >>> addh = AddHydrogens()

      >>> hat = addh.addHydrogens(atoms, method='withBondOrder')


      atoms has to be a list of atom objects as above and

      Bond:

          b .atom1 : instance of Atom

          b .atom2 : instance of Atom

          b .bondOrder : integer


      these calls return a list 'hat' containing a tuple for each Hydrogen
      atom to be added. This tuple provides:

          coordsH       : 3-float coordinates of the H atom

          atom          : the atom to which the H atom is to be connected

          atomic_number : the babel_atomic_number of the H atom

          type          : tyhe b:wabel_type of the H atom


reimplementation of Babel1.6 in Python by Michel Sanner April 2000
Original code by W. Patrick Walters and Matthew T. Stahl

    



Instance Methods [hide private]
  __init__(self, func=None)
  onAddCmdToViewer(self)
method called when an instance of this command is added to the viewer.
  __call__(self, nodes, polarOnly=False, method='noBondOrder', renumber=True, **kw)
AtomSet <- add_h(nodes, polarOnly=0, method='noBondOrder, renumber=1,**kw) nodes --- TreeNodeSet holding the current selection polarOnly --- default is False method --- Hydrogen atoms can be added using 2 different methods, ex --- method='withBondOrder', default is 'noBondOrder' renumber --- default is True Returns an atomSet containing the created H atoms NOTE: This command adds hydrogens to all atoms in the molecule specified using the nodes argument.
  doit(self, nodes, polarOnly=False, method='noBondOrder', renumber=True)
None <- add_h(nodes, polarOnly=False, method='noBondOrder', renumber=True)

Inherited from mvCommand.MVCommand: guiCallback, strArg

Inherited from mvCommand.MVCommand (private): _strArg

Inherited from ViewerFramework.VFCommand.Command: __repr__, addCallbackAfter, addCallbackBefore, addUndoCall, afterDoit, beforeDoit, buildFormDescr, buildLogArgList, checkDependencies, cleanup, customizeGUI, doitWrapper, getArguments, getHelp, getLastUsedValues, getLogArgs, getValNamedArgs, log, logString, onAddNewCmd, onCmdRun, setLastUsedValues, setupUndoAfter, setupUndoBefore, showForm, tkCb, updateGeom, warningMsg


Class Variables [hide private]

Inherited from ViewerFramework.VFCommand.Command: negateKw, objArgOnly


Method Details [hide private]

__init__(self, func=None)
(Constructor)

source code 
None
Overrides: mvCommand.MVCommand.__init__

onAddCmdToViewer(self)

source code 
method called when an instance of this command is added to the viewer. This enable viewer-addition time initializations
Overrides: ViewerFramework.VFCommand.Command.onAddCmdToViewer
(inherited documentation)

__call__(self, nodes, polarOnly=False, method='noBondOrder', renumber=True, **kw)
(Call operator)

source code 

        AtomSet <- add_h(nodes, polarOnly=0, method='noBondOrder,
                         renumber=1,**kw)
        
nodes --- TreeNodeSet holding the current selection
        
polarOnly --- default is False
        
method --- Hydrogen atoms can be added using 2 different methods,
        
ex --- method='withBondOrder', default is 'noBondOrder'
        
renumber --- default is True 
        
Returns an atomSet containing the created H atoms
        
NOTE: This command adds hydrogens to all atoms in the molecule
        specified using the nodes argument.
        
The hydrogen atoms added to each molecule are also saved as a set
        called mol.name + '_addedH'
        

Overrides: ViewerFramework.VFCommand.Command.__call__

doit(self, nodes, polarOnly=False, method='noBondOrder', renumber=True)

source code 
None <- add_h(nodes, polarOnly=False, method='noBondOrder', renumber=True)
Overrides: ViewerFramework.VFCommand.Command.doit