from IPython.display import Image
import os, sys
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
import pymol
pymol.finish_launching()
from pymol import cmd
cmd.fetch("1LMP")
cmd.ray()
cmd.png('im.png')
Image(filename='im.png')
cmd.do("""
bg_color white
select nag, resn nag or resn ndg
select cont, (all w. 4.0 of nag) and not het
select contnh1, (all w. 4.0 of nag) and not het and not n. C*
color wheat, (all)
color yellow, (nag)
color cyan,(contnh1)
util.cnc (nag or contnh1)
zoom (all w. 6.0 of nag)
show surface, cont
show sticks, resi 103 or nag
hide nonbonded, resn hoh
rotate y, 90
set transparency, 0.2
""")
cmd.ray()
cmd.png('im2.png')
Image(filename='im2.png')