Skip to content

Jarv's Pymol Horrors

Jarvist Moore Frost edited this page May 16, 2024 · 9 revisions

Hints and Tricks for Pymol

set orthoscopic, on - no silly perspective distortions

set spec_reflect, 0.0 - turn off specular reflections (shiny ness), makes a very nice flat colour aesthetic for spheres

set light_count, 0 - set number of directed lights to zero, therefore no shadows (also speeds ray trace)

set ambient, 0.6 ; set, direct 0.4 - play with mix of ambient and direct light. Fully ambient and your spheres are glowing and you can't see the edges

show spheres - the way to solid state joy; show vdW spheres for your atoms

Extracting for quantum calculations

Pymol actually has quite a nice Python based scripting / extracting language, and as it is built into the viewer you can experiment 'live' and then develop this into a pymol script. However, I find it really difficult to remember the syntax.

For instance, extracting WHOLE amino acid residues within a cut-off around a metal ion, for metalloenzyme quantum calculations.

# Extract around the Zn site to generate a cluster for higher level quantum calculation

load '../0001-Svensson2015-SI/TSII.xyz', TSII

create TSII-3A, %TSII and byres (all within 3.0 of name Zn)
save TSII-3A.sdf, TSII-3A

create TSII-4A, %TSII and byres (all within 4.0 of name Zn)
save TSII-4A.sdf, TSII-4A

create TSII-5A, %TSII and byres (all within 5.0 of name Zn)
save TSII-5A.sdf, TSII-5A

Ray Tracing

A good starting point for ray tracing:

set ray_orthoscopic, on # no silly perspective
set ray_trace_fog, 0  # off

set ambient, 1
set reflect, 0
set specular, off # dull balls

bg_color white
set antialias, 2
set ray_shadows, off

viewport 1920,1080

set antialias, 2 - maximum anti-alias for ray tracing

bg_color white - white background for publication; requires anti-alias + ray trace to avoid jaggies

ray 2048, 1524 ; save raytrace.png - large poster / slide friendly ray trace & immediately save, to avoid risking disrupting Pymol with an inconsiderate mouse move while it's raytracing

Atom-based (or selection based) differentiation:

color grey, (name N*)

set transparency, 0.2, (name N*)

show spheres, (name Cs) - put a nice big vdW sphere on the Cs ions

odd form for stick_transparency (i.e. what we're always doing for organic electronics) set_bond stick_transparency, 0.2, (name N*)

Coarse grain simulations

Most useful thing is to show spheres, then manipulate the vdW radii to fit the 'pseudo atom' you are modelling. You can also use this to make nice intersecting pseudo-atom + atomistic model renders.

alter (name c), vdw=5.1
alter (name p), vdw=5.0
show spheres

HD Video for YouTube

Google's resolution / etc. https://support.google.com/youtube/answer/1722171?hl=en

Set pymol to correct aspect ratio for widescreen with 'viewport 1280,720'

  • 2160p: 3840x2160
  • 1440p: 2560x1440
  • 1080p: 1920x1080
  • 720p: 1280x720

Fiddle with your settings & make a movie, check scenes individually with 'ray' before setting 'ray trace frames', then save as PNG.

Generate libx264 mp4 file with ffmpeg:-

via http://superuser.com/questions/533695/how-can-i-convert-a-series-of-png-images-to-a-video-for-youtube

ffmpeg -framerate 30 -i 6x6x6_battenberg_50K_raytrace_spheres_%04d.png -s:v 1280x720 -c:v libx264 -profile:v high -crf 23 -pix_fmt yuv420p -r 30 youtube.mp4

'-crf' -> "constant rate factor"; preserves level of quality in scenes. Set to 18 for more or less perfect reproduction (i.e. when you've just spent a lot of CPU time making nice antialiased renders!). You seem to need to set it lower when your render is higher resolution, for a similar feel in quality.

Clone this wiki locally