Package rdkit :: Package Chem :: Module ShowMols

[hide private]
[frames] | no frames]

# Source Code for Module rdkit.Chem.ShowMols

     1  # $Id$
     2  #
     3  # Copyright (C) 2004-2006 Rational Discovery LLC
     4  #
     5  #   @@ All Rights Reserved @@
     6  #  This file is part of the RDKit.
     7  #  The contents are covered by the terms of the BSD license
     8  #  which is included in the file license.txt, found at the root
     9  #  of the RDKit source tree.
    10  #
    11  from rdkit import RDConfig
    12
    13  # change this to use another viewer:
    14  if RDConfig.molViewer in ('WEBLAB','DSVIEWER'):
    15    from rdkit.Chem.DSViewer import *
    16  elif RDConfig.molViewer=='PYMOL':
    17    from rdkit.Chem.PyMol import *
    18  else:
    19    raise ValueError('invalid RD_MOLVIEWER specified')
    20
    21
    22
    23  if __name__=='__main__':
    24    import AllChem
    25    import sys
    26    if len(sys.argv)<2:
    27      smi ='c1cccc2c1cccc2CC(=O)N'
    28    else:
    29      smi = sys.argv[1]
    30
    31    m = Chem.MolFromSmiles(smi)
    32    m = Chem.AddHs(m)
    33    AllChem.EmbedMolecule(m)
    34    v = MolViewer()
    35    v.ShowMol(m,'raw')
    36    AllChem.UFFOptimizeMolecule(m)
    37    v.ShowMol(m,'opt',showOnly=0,highlightFeatures=[(0,),(2,),(3,4)])
    38