CSC Spring School 2017

Visualising Your Results

An Introduction to VMD

Michael Patzschke Institute for Resource Ecology HZDR

16.03.2017

Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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 (rendered, use of CUDA) • Highly Scriptable • Many useful tools

Page 2 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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 • Visualizing MO’s via molden file format • Saving your work

Page 3 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Lets See What VMD Can Do

Page 4 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Lets See What VMD Can Do

Page 5 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Lets See What VMD Can Do

Page 6 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Lets See What VMD Can Do

Page 7 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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) • Latest Version 1.9.3 • Good documentation • Tutorials available – For tutorials: http://www.ks.uiuc.edu/Training/Tutorials/ – Not only VMD, also NAMD, FreeEnergy …

Page 8 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Installation

• Windows – Open the installer, rest is automatic • Mac – Open the downloaded file, put the VMD icon in the Application folder – Irritating bug on Yosemite, don’t use browse in File menu! – Put the following in you .profile: vmdappdir='/Applications/VMD_1.9.2.app/Contents’ alias vmd='"$vmdappdir/Resources/VMD.app/Contents/MacOS/VMD" $*' • 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.

Page 9 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Starting VMD

• Start by clicking the icon (Win & Mac) or by typing “vmd” at a terminal • Look around, different windows are opened (customizable)

Page 10 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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)

Page 11 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Configuring VMD

• Can be done via menu:

Page 12 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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) – Who knows what a spotless smooth-hound is?

Page 13 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de The Spotless Smooth-Hound

Page 14 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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 • Can also be used to measure distances and angles try Label -> Bonds • Try moving Atoms or whole residues • When visualising MD runs, wrong, very long bonds can appear use this feature to delete them

Page 15 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Manipulating The View

• While picking atoms and residues have a look at the vmd terminal window

Page 16 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Different Representations

• Open the “Representation” window from Main window • Choose different Drawing Methods • Note how the controls change • Changing the coloring method • “Selected Atoms” tool – Try “helix” or “not helix” or “(not helix) and (not (not protein))

Page 17 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de More On Selections

• See tab “Selections” • Filters can be constructed

• Selecting a keyword shows possible values

• Example: double-click “resname” Double-click e.g. “ALA”

Page 18 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Even More on Selections

• VMD has very sophisticated selection methods • Try some of the following here: name FE resid 35 name CA and resname ALA backbone not protein protein (backbone or name H) name "C.*” mass < 5 numbonds = 2 abs(charge) > 1 x < 6 and x > 3 sqr(x-5)+sqr(y+4)+sqr(z) > sqr(5) within 5 of name FE protein within 5 of nucleic same resname as (protein within 5 of nucleic)

Page 19 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Saving Selections

• In the representation window write: within 5 of name FE • In the Main window click query • Now click on one of the iron atoms in the hemes Look at the vmd startup window (terminal) Get the index number • Write in the representation window: within 5 of index 4358 • To save this selection select molecule in mmain winndow then click on File – Save Coordinates • Put selection in the “Selected Atoms” field • And Save

Page 20 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Multiple Representaions

• 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

Page 21 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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

Page 22 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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:

Page 23 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Scripting

• VMD contains a powerful scripting language • Available through startup-command window or from “Extensions TK console”

• Examples: set variable value assigns 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

Page 24 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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

Page 25 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Scripting

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

• Remember, can be done via menu

Page 26 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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 here, 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

Page 27 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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, certain basis set restrictions apply – 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

Page 28 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Visualising 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

Page 29 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Visualising 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

Page 30 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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

Page 31 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de 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)

Page 32 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Slicing A Cube

• Choose “Volume Slice” as drawing method • Choose “Throb” as coloring method

• Slice at different points using “Slice Offset”

Page 33 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Other Things To Try

• Use online tutorials • Play around • Look at the “Extensions” Menu in the Main Window

Page 34 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de Have Fun!

• Thank you for your attention

Page 35 Member of the Helmholtz Association Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de