rdkit.Chem.PyMol module — The RDKit 2025.09.6 documentation

# rdkit.Chem.PyMol module

uses pymol to interact with molecules

class rdkit.Chem.PyMol.MolViewer(host=None, port=9123, force=0, **kwargs)

  Bases: `object`

  AddPharmacophore(locs, colors, label, sphereRad=0.5)

    adds a set of spheres

  DeleteAll()

    blows out everything in the viewer

  DeleteAllExcept(excludes)

    deletes everything except the items in the provided list of arguments

  DisplayCollisions(objName, molName, proteinName, distCutoff=3.0, color='red', molSelText='(%(molName)s)', proteinSelText='(%(proteinName)s and not het)')

    toggles display of collisions between the protein and a specified molecule

  DisplayHBonds(objName, molName, proteinName, molSelText='(%(molName)s)', proteinSelText='(%(proteinName)s and not het)')

    toggles display of h bonds between the protein and a specified molecule

  DisplayObject(objName)
  GetAtomCoords(sels)

    returns the coordinates of the selected atoms

  GetPNG(h=None, w=None, preDelay=0)
  GetSelectedAtoms(whichSelection=None)

    returns the selected atoms

  HideAll()
  HideObject(objName)
  HighlightAtoms(indices, where, extraHighlight=False)

    highlights a set of atoms

  InitializePyMol()

    does some initializations to set up PyMol according to our tastes

  LoadFile(filename, name, showOnly=False)

    calls pymol’s “load” command on the given filename; the loaded object is assigned the name “name”

  Redraw()
  SaveFile(filename)
  SelectAtoms(itemId, atomIndices, selName='selection')

    selects a set of atoms

  SelectProteinNeighborhood(aroundObj, inObj, distance=5.0, name='neighborhood', showSurface=False)

    selects the area of a protein around a specified object/selection name; optionally adds a surface to that

  SetDisplayStyle(obj, style='')

    change the display style of the specified object

  SetDisplayUpdate(val)
  ShowMol(mol, name='molecule', showOnly=True, highlightFeatures=[], molB='', confId=-1, zoom=True, forcePDB=False, showSticks=False)

    special case for displaying a molecule or mol block

  Zoom(objName)