예제 #1
0
def make_pov(file, meta=True):
    f1, f2 = file, file[:-4] + '.inc'

    (header, data) = cmd.get_povray()
    povfile = open(f1, 'w')
    if meta: povfile.write(header)
    povview = cmd.get_view()

    povfile.write("""\n
// Uncomment the following lines if you have the pymolmacro.inc include file and want to use it.
/*
#include \"pymolmacro.inc\"
PYMOL_VIEW( %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f )
*/
 
""" % povview)
    povfile.write('#include "%s"\n\n' % f2)
    povfile.close()
    povfile = open(f2, 'w')
    povfile.write(data)
    povfile.close()
예제 #2
0
def make_pov(file):
  """
  Do "run make_pov.py" from within pymol and then execute the script                                
  with "make_pov('povray.inp')" to create the povray.inp file.                                      
 
  make note of the dimensions written out by this script and use the
  same (or the same ratio) within povray:
  e.g. output (the "vol" lines only appear if spheres are present):
                                                                                                    
   PyMOL>make_pov('povray.inp')
    RayRenderPOV: w 1100 h 900 f   63.349 b  102.310
    RayRenderPOV: vol  -17.316   17.316  -14.168
    RayRenderPOV: vol   14.168   63.349  102.310
    RayRenderPovRay: processed 714 graphics primitives.
    Ray: total time: 0.03 sec. = 123885.9 frames/hour. (0.03 sec. accum.)
 
  So for example, you would run povray with:
    povray +Ipovray.inp +W1100 +H900
  or
    povray +Ipovray.inp +W550 +H450
  """
  (header,data) = cmd.get_povray()
  povfile=open(file,'w')
  povfile.write(header)
  povfile.write(data)
  povfile.close()
예제 #3
0
파일: pykflow.py 프로젝트: jkjium/kflow
	def saveSC(self):
		(pov_header, pov_body) = cmd.get_povray()
		self.p = pov()
		self.p.globalShaderFactory.seleShader = self.spColorShaderDict
		self.p.globalImage.setFloorColor(self.bgColor)
		self.p.globalImage.setFloorShader(self.optionMenu_bgShader.getvalue())
		self.p.globalImage.setGlobalShader(self.optionMenu_shader.getvalue())
		self.p.globalImage.setFloorShadow(self.dropShadow.get())
		self.p.globalImage.setOutputWidth(int(self.varImageWidth.get()))
		self.p.globalImage.setFloorAngle(self.stageAngle)		


		# shader settings
		self.p.globalShaderFactory.colorSpace = self.optionMenu_colorSpace.getvalue()
		self.p.globalShaderFactory.shaderSamples = self.shaderSamples
		self.p.globalShaderFactory.phongSpec = self.phongSpec
		self.p.globalShaderFactory.shinyRefl = self.shinyRefl
		self.p.globalShaderFactory.glassETA = self.glassETA


		if self.dofDist != -1:
			self.p.globalCamera.attr['type'] = 'thinlens'
			# will be used in p.parsePov
			# change fdist before p.camera writing SCString
			self.p.globalCamera.dofScale = self.dofDist 

		self.p.parsePov(''.join([pov_header, pov_body]))		
		self.console.set('%28s' % ('kflow.sc saved.'))
예제 #4
0
def make_pov(file, meta=True):
        f1, f2 = file, file[:-4] + '.inc'
 
        (header,data) = cmd.get_povray()
        povfile = open(f1,'w')
        if meta: povfile.write(header)
        povview = cmd.get_view()
 
        povfile.write("""\n
// Uncomment the following lines if you have the pymolmacro.inc include file and want to use it.
/*
#include \"pymolmacro.inc\"
PYMOL_VIEW( %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f,
            %10.5f, %10.5f, %10.5f )
*/
 
""" % povview)
        povfile.write('#include "%s"\n\n' % f2)
        povfile.close()
        povfile = open(f2,'w')
        povfile.write(data)
        povfile.close()
예제 #5
0
 def testGetPovray(self):
     cmd.fragment('gly')
     cmd.show_as('sticks')
     pov = cmd.get_povray()
     self.assertTrue(isinstance(pov, tuple))
     self.assertEqual(len(pov), 2)
     self.assertTrue(pov[0].startswith('camera {direction<0.0,0.0'))
     self.assertTrue(pov[1].startswith('cylinder{<'))
예제 #6
0
from pymol import cmd
import os

if not ('pept' in cmd.get_names()):
    cmd.delete('all')
    util.ray_shadows('heavy')
    cmd.do('load $PYMOL_PATH/test/dat/pept.pdb')
    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("x-povray +Itmp_pymol.pov +Otmp_pymol.png +W300 +H300 +A")
예제 #7
0
파일: pykflow.py 프로젝트: jkjium/kflow
	def render(self, renderType):
		#cmd.do('save t.pov')
		#print 'image width: %d' % (int(self.varImageWidth.get()))
		#print 'drop shadow: %s' % self.dropShadow.get()
		#print 'bg color: %s' % (self.bgColor)
		#print 'stage angle: %d' % (self.stageAngle)
		#print 'molecule shader: %s' % self.optionMenu_shader.getvalue()
		#print 'background shader: %s' % self.optionMenu_bgShader.getvalue()
		try:
			os.unlink('kflow.sc')
			os.unlink('output.png')
		except:
			#traceback.print_exc()
			pass

		(pov_header, pov_body) = cmd.get_povray()
		self.p = pov()
		self.p.globalShaderFactory.seleShader = self.spColorShaderDict
		self.p.globalImage.setFloorColor(self.bgColor)
		self.p.globalImage.setFloorShader(self.optionMenu_bgShader.getvalue())
		self.p.globalImage.setGlobalShader(self.optionMenu_shader.getvalue())
		self.p.globalImage.setFloorShadow(self.dropShadow.get())


		# shader settings
		self.p.globalShaderFactory.colorSpace = self.optionMenu_colorSpace.getvalue()
		self.p.globalShaderFactory.shaderSamples = self.shaderSamples
		self.p.globalShaderFactory.phongSpec = self.phongSpec
		self.p.globalShaderFactory.shinyRefl = self.shinyRefl
		self.p.globalShaderFactory.glassETA = self.glassETA


		if renderType == '':	
			self.console.set('%28s' % ('Full Render'))
			self.p.globalImage.setOutputWidth(int(self.varImageWidth.get()))
		else:
			self.console.set('%28s' % ('Render IPR'))
			self.p.globalImage.setOutputWidth(800)
		self.p.globalImage.setFloorAngle(self.stageAngle)		
		if self.dofDist != -1:
			self.p.globalCamera.attr['type'] = 'thinlens'
			# will be used in p.parsePov
			# change fdist before p.camera writing SCString
			self.p.globalCamera.dofScale = self.dofDist 
		self.p.parsePov(''.join([pov_header, pov_body]))

		sunflowpath = os.path.expanduser('~')+'/kflow.jar'
		#print sunflowpath
		if os.path.isfile(sunflowpath) != True:
			self.getSunflow(sunflowpath)

		path_java='\"'+sunflowpath.replace('\\', '/')+'\"'

		cmd_args = '%s -v 0 -o output.png kflow.sc' % (renderType)
		print 'Start rendering ...'
		p=subprocess.Popen('java -jar '+path_java+' '+cmd_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

		while True:
			out = p.stdout.read(1)
			if out == '' and p.poll() != None:
				break
			if out!='':
				sys.stdout.write(out)
				sys.stdout.flush()
예제 #8
0
from pymol import cmd
import os

if not ('pept' in cmd.get_names()):
   cmd.delete('all')
   util.ray_shadows('heavy')
   cmd.do('load $PYMOL_PATH/test/dat/pept.pdb')
   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("x-povray +Itmp_pymol.pov +Otmp_pymol.png +W300 +H300 +A")
cmd.load_png('tmp_pymol.png')

예제 #9
0
def make_pov(file):
    (header, data) = cmd.get_povray()
    povfile = open(file, 'w')
    povfile.write(header)
    povfile.write(data)
    povfile.close()
예제 #10
0
파일: make_pov.py 프로젝트: jkjium/kflow
def make_pov(file):
	(header,data) = cmd.get_povray()
	povfile=open(file,'w')
	povfile.write(header)
	povfile.write(data)
	povfile.close()
예제 #11
0
cmd.space("cmyk")
cmd.bg_color(color="white")

cmd.load('4hea_vis_res.pdb')
cmd.load('6rfr_vis_res.pdb')
cmd.load('refined_cav.pdb')
cmd.load('6rfr_UQ9_realigned.pdb')

cmd.hide(representation="everything", selection="all")
cmd.show(representation="mesh", selection="refined_cav")
cmd.show(representation="sticks", selection="4hea_vis_res")
cmd.show(representation="spheres", selection="6rfr_UQ9_realigned")
cmd.show(representation="sticks", selection="6rfr_vis_res")

cmd.do('color cyan, 6rfr_UQ9_realigned and name C*')
cmd.do('color cyan, 6rfr_vis_res and name C*')
cmd.do('color pink, 4hea_vis_res and name c*')
cmd.do('color pink, refined_cav')

cmd.zoom("all", complete=1)
cmd.rotate("z", angle=90)
cmd.rotate("x", angle=90)

pov_file = open('pymol_scene_no_hydrogens_tyr_marker_set.pov', 'w')
for part in cmd.get_povray():
    pov_file.write(part)
pov_file.close()

cmd.quit()