from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
import pymol
pymol.finish_launching()
from pymol import cmd
from IPython.display import Image
cmd.delete('all')
cmd.fetch('1lmp')
cmd.do('''
bg_color white
remove solvent
extract ligands,het
as sticks, ligands
as cartoon, 1lmp
color gray, 1lmp
set cartoon_transparency, 0.5, 1lmp
set stick_transparency, 0.5, 1lmp
hide surface, all
show stick, byres(1lmp w. 4 of ligands)
label (n. CA and byres(1lmp w. 4 of ligands)), (resn, resi)
set label_color, black
center ligands
zoom byres(1lmp w. 4 of ligands)
dist hbo,1lmp,ligands,3.2,mode=2
ray
png pic1.png
''')
Image(filename='pic1.png')
ipython nbconvert Untitled0.ipynb --to html