1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
from pymol import cmd
import os
if not ('pept' in cmd.get_names()):
cmd.delete('all')
util.ray_shadows('heavy')
example_path = "$PYMOL_PATH/test/dat/pept.pdb"
if not os.path.exists(example_path):
from inspect import getsourcefile
current_file_dir = os.path.dirname(os.path.abspath(getsourcefile(lambda:0)))
example_path = os.path.join(current_file_dir, "../../test/dat/pept.pdb")
cmd.do('load ' + example_path)
cmd.do('set surface_quality=1')
cmd.do('show surface;hide lines;')
cmd.zoom('all',10)
cmd.do('clip far,-40;show surface;hide lines;set smooth_color=1')
cmd.viewport(300,300)
pov = cmd.get_povray()
f=open("tmp_pymol.pov",'w')
f.write(pov[0])
f.write("#include \"colors.inc\"\n");
f.write("#include \"stones.inc\"\n");
f.write("#include \"woods.inc\"\n");
f.write(pov[1])
f.write("plane {<0,1,0.5>, -70 texture{T_Grnt10 scale 40}}\n");
f.write("sphere {<14,4,-132>, 7.0 pigment{color Grey} finish{reflection 1.0 metallic}}\n");
for x in range(-30,30,5):
f.write("sphere {<%6.4f,-12,-100>, 2.0 texture{P_WoodGrain1B scale 8}}\n"%(x))
f.write("box {<-17,17,-120>,<13,15,-160> pigment {color Red}}\n")
f.close()
cmd.refresh()
os.system("povray +Itmp_pymol.pov +Otmp_pymol.png +W300 +H300 +A")
cmd.load_png('tmp_pymol.png')
|