User:Orpheus

From PyMOLWiki
Jump to: navigation, search

Tzintzuni Garcia

University of Texas Medical Branch
Department of Human Biological Chemistry and Genetics
Graduate Student

Graphics

I'll be posting some ideas for logos and graphics for this page in the next week or so.

PyMOL Wiki title image 1

Code Test

from math import log
base = 'expt100000.1HJM_int'
cmd.set('auto_zoom', 'off')
cmd.set('bg_rgb', ('0', '0', '0'))
cmd.set('hash_max', 240)
repeat = 8 #number of frames to repeat each structure

for n in range(1,501):
    curmol = base[0:5]+str(n).zfill(5)+base[10:]
#    print curmol+'.pdb'
    cmd.load(curmol+'.pdb')
    if n > 1:
        cmd.fit(curmol+' and name ca and (resi 56 or resi 57 or resi 58)', oldmol+' and name ca and (resi 56 or resi 57 or resi 58)')
        cmd.delete(oldmol)
#        cmd.reset(curmol+' and name ca and (resi 56 or resi 57 or resi 58)')
#        cmd.origin(curmol+' and name ca and (resi 56 or resi 57 or resi 58)')
#        cmd.zoom(curmol)
    else:
        cmd.orient(curmol+' and name ca and (resi 56 or resi 57 or resi 58)')
        cmd.center(curmol+' and name ca and (resi 56 or resi 57 or resi 58)')
#        cmd.zoom(curmol)
#    util.chainbow(curmol)
    cmd.spectrum('count', 'blue_white_red', '('+curmol+')',minimum=None, maximum=None, byres=1, quiet=1)
    cmd.hide("lines", curmol)
#    cmd.show("surface", curmol)
    cmd.show("cartoon", curmol)
#    cmd.set_view ('\
#     1.000000000,    0.000000000,    0.000000000,\
#     0.000000000,    1.000000000,    0.000000000,\
#     0.000000000,    0.000000000,    1.000000000,\
#     0.000000000,    0.000000000, -717.288574219,\
#    35.836936951,   12.674762726,   -6.756893158,\
#   565.515808105,  869.061340332,    0.000000000' )
    cmd.set_view('\
     1.000000000,    0.000000000,    0.000000000,\
     0.000000000,    1.000000000,    0.000000000,\
     0.000000000,    0.000000000,    1.000000000,\
     0.000000000,    0.000000000, -234.718002319,\
    10.384142876,   15.351722717,   11.246277809,\
   205.446594238,  263.989440918,    0.000000000' )
    cmd.translate([0,0,-0.0008*n*log(n)], curmol, 0, 1, None)
#    cmd.zoom(curmol)
    cmd.clip('far', -0.5*n*log(n))
    cmd.clip('near', -0.05*n*log(n))
## Uncomment one line to render frames ##
#    cmd.ray(1680, 1050) # 16:10 1764000 
#    cmd.ray(1024, 576) # 16:9 589824
#    cmd.ray(800, 450) # 16:9 360000
#    cmd.ray(640, 360) # 16:9 230400
#    cmd.ray(480, 270) # 16:9 129600
#    cmd.ray(240, 180) # 16:9 43200 
#    cmd.ray(1024, 768) # 4:3 786432
    cmd.ray(800, 600) # 4:3 4800000
#    cmd.ray(640, 480) # 4:3 307200
#    cmd.ray(480, 360) # 4:3 172800
#    cmd.ray(240, 180) # 4:3 43200
## Uncomment loop to repeat frames ##
    for i in range(0,repeat):
        cmd.png("imgs/"+str((n-1) * repeat + i).zfill(5)+".png")
    cmd.refresh()
    oldmol = curmol