CSC Spring School 2014

Visualizing Your Results

- An Introduction to VMD -

Michael Patzschke University of Helsinki

The Code

● VMD – visualizing – Developed by Theoretical & Computational Biophysics Group (University of Illinois) – Freely available (registration necessary) – For , MacOS & Windows – Go to http://www.ks.uiuc.edu/Research/vmd/ – Other codes: NAMD, MDFF

● Professionally developed GUI

● High quality graphics

● Scriptable

● Many useful tools

Learning Outcome

● Installing VMD

● Opening molecular structures

● Creating different representations – Manipulating selections

● Rendering high quality graphics

● Making movies

● Scripting – Configuring vmd

● Visualizing cube & plt files

● Saving your work

Lets See What VMD Can Do

Lets See What VMD Can Do ...

Lets See What VMD Can Do

Getting VMD

● VMD produces high quality graphical output – Local installation preferable

● After choosing the appropriate version – Source code / Mac / Unix / Windows, w/o CUDA

● Registration (might take a day or two)

● Download ca 20MB (sources more)

● Good documentation and tutorials available – For tutorials: http://www.ks.uiuc.edu/Training/Tutorials/

Installation

● Windows – Open the installer, rest is automatic

● Mac – Open the downloaded file, put the VMD icon in the Application folder

● Linux – Unpack the downloaded file

– Change $install_bin_dir and $install_lib_dir in the “configure” file

– Run ./configure

– Enter “src” directory, run make install – Make sure the “install_bin_dir” is in your path

● Compiling from source – use programmers guide. Good luck.

Starting VMD

● Start by clicking the icon (Win & Mac) or by typing “vmd” at a terminal Mac: add “alias vmd='/Applications/VMD\ 1.9.1.app/Contents/MacOS/startup.command' ” to .profile (not necessary)

● Look around, different windows are opened (customizable)

Configuring VMD

● Standard setting can be changed – Look at colors – Change appearance

● This can be done in a startup file – File “.vmdrc” searched for in current, home, install directory – More later (scripting)

Opening a Structure File

● VMD open 72 different formats of structure files – Can convert a further 50 (like QC-program output) – Pdb files will be downloaded (give four-letter code)

– Try “1GCW” (CO form hemoglobin from a spotless smooth-hound)

Manipulating the View

● Rotate molecule in display window – left click normal rotation, right click around z-axis (Mac “cmd”+click) – Other modes available from “Mouse” menu in main window – Try e.g. centering the molecule (press c in display window – click – press r to rotate) – Press = to reset view

● Try giving the molecule a spin

Different Representations

● Open the “Representation” window from Main window

● Choose different representations

● Note how the controls change

● Changing the coloring method

● “Selected Atoms” tool – Try “helix” or “not helix” or “(not helix) and (not (not protein))

More On Selection

● See tab “Selections”

● Filters can be constructed

● Selecting a keyword shows possible values – e.g. double-click “resname” Double-click e.g. “ALA”

Multiple representations

● Go back to the “Draw Style” tab, write all in the atom selection

● Choose “New Cartoon” from “Drawing Method”

● Press “Create Rep”

● Write “not protein” in atom selection

● Choose “CPK” from “Drawing Method”

● Change Material (presets can be changed) – Try changing “Rendermode” to “GLSL”

● Change resolution

● Many more representations can be added

Producing High Quality Graphics

● Rendering of images: choose “Render” from Main Window – File menu'

● Different renderers available

● Tachyon will reprocess the picture, results may be slightly different

● For the others: If window is blocked, so will be the rendered picture

● Choose Tachyon

● Add “res 1000 1000” to the Render Command

● Press “Start Rendering”

● You may want to start with smaller resolution, for faster results

● Use convert to get a jpg if needed: $>convert vmdscene.tga myname.jpg

Multiple Molecules

● Open ”File – New Molecule” from the main window

● Notice “Load files for:” data can be loaded into existing files

● Selecting “New Molecule” to load another molecule

● Main window is changed ● Change molecule name by double-click

● T,A,D,F for top, active, drawn, fixed try double-clicking to see the effect

● Also available from “Main Window - Molecule”

● Delete molecules here:

Scripting

● VMD contains a powerful scripting language

● Available through startup-command window or from “Extensions TK console”

● Examples: set variable valueassigns value to variable puts $variable writes variable on screen expr expression evaluates mathematical expression

● Try e.g.: set a 2 set b 4 set result [expr $a*$b/8] puts result

● Molecules can be selected, moved and edited with script commands

Scripting

● Information can be obtained about loaded molecules set [atomselect top "all"] $crystal num $crystal moveby {10 0 0} $crystal move [transaxis x 40 deg]

● Lines and shapes can be added to molecules graphics top cylinder { 0 0 0} { -15 0 10} radius 5 resolution 60 filled yes

● A powerful example: load the pdb files: 1fqy.pdb and 1rc2.pdb (human and e.coli aquaporin)

– In the console do: set sel0 [atomselect 1 all] set sel1 [atomselect 2 all] set M [measure fit $sel0 $sel1] $sel0 move $M – Check the MolID! Yours might be different

Scripting

● The start file is a script, check this example:

Making Movies

● Trajectory files and optimization files (e.g. from TM or Orca) can be opened

● Trajectory data can be loaded into existing files (e.g. NAMD .dcd files)

● Example simple optimization – Open movie.xyz – Contains 43 frames – Play optimization – Choose frames, choose animation mode

● High quality movies can be made from “Extension – – Movie Maker”

● Both trajectories or movement of a single frame possible

Visualizing Volumes

● VMD is a good tool for visualizing cube files (e.g. densities or orbitals)

● Orbitals can be visualized directly from GAMESS output files, .log files and molden input files – Caveat: molden files have to be generated by molden – Test: run a simple orca calculation orca h2o.inp > h2o.out orca_2mkl h2o -molden – try opening the resulting molden file (select molden filetype in vmd) – In “Representation” window try “Orbital” the orbital selection is greyed out – Now open the molden file in molden and save it again (molden h2o.molden.input)

Visualizing Orbitals

● Open the new molden file or take the one provided (zn_tpen.molden) – Go to “Graphics - Representations” – Add a new representation – Change “Drawing Method” to “Orbital” – Choose an orbital – Change the isovalue – Change coloring method to ColorID – Choose e.g. blue – Add another rep – Change isovalue to the opposite you had – Change color to e.g. red

Visualizing Orbitals

● Try the same with the GAMESS output file provided (terpy.log)

● Some observations: – Be sure to change the orbital number for both phases – Preselect the orbital range (Orbital menu only shows 20) – Might seem tedious, but rendered results are very good

Mapping Cube files

● Load the provided cube file “h2o.eldens.cube”

● Into that data set load “h2o.mep.cube”

● Note the two volumes in the data set

● Go to the Representations window

● Add a representation

● Choose “Isosurface” as drawing method

● Change “Coloring Method” to “Volume”

● Change “Draw” to “Solid Surface”

● Change “Show” to “Isosurface”

● Choose eldens.cube as the volume

● Choose mep.cube to map

Mapping Cube files

● Go to the tab “Trajectory”

● Change “Color Scale Data Range” to get a good result

● Color scale can be changed in “Graphics – Colors” (Main Window)

Slicing a Cube

● Choose “Volume Slice” as drawing method

● Choose “Throb” as coloring method

● Slice at different points using “Slice Offset”

Other Things To Try

● Use online tutorials

● Play around

● Look at the “Extensions” Menu in the Main Window

Have fun!

● Thank you for your attention