Package Chem :: Module ShowMols
[hide private]
[frames] | no frames]

Source Code for Module Chem.ShowMols

 1  # $Id: ShowMols.py 746 2008-07-07 13:21:24Z glandrum $ 
 2  # 
 3  # Copyright (C) 2004-2006 Rational Discovery LLC 
 4  # 
 5  #   @@ All Rights Reserved  @@ 
 6  # 
 7  import RDConfig 
 8   
 9  # change this to use another viewer: 
10  if RDConfig.molViewer in ('WEBLAB','DSVIEWER'): 
11    from Chem.DSViewer import * 
12  elif RDConfig.molViewer=='PYMOL': 
13    from Chem.PyMol import * 
14  else: 
15    raise ValueError,'invalid RD_MOLVIEWER specified' 
16   
17     
18     
19  if __name__=='__main__': 
20    import AllChem 
21    import sys 
22    if len(sys.argv)<2: 
23      smi ='c1cccc2c1cccc2CC(=O)N' 
24    else: 
25      smi = sys.argv[1] 
26   
27    m = Chem.MolFromSmiles(smi) 
28    m = Chem.AddHs(m) 
29    AllChem.EmbedMolecule(m) 
30    v = MolViewer() 
31    v.ShowMol(m,'raw') 
32    AllChem.UFFOptimizeMolecule(m) 
33    v.ShowMol(m,'opt',showOnly=0,highlightFeatures=[(0,),(2,),(3,4)]) 
34