Visualising normal modes using VMD and OPTIM

From CUC3
Jump to navigation Jump to search

In order to visualise normal modes in this way - you need to have done a harmonic normal mode analysis of the system using OPTIM. Details on how to do this can be found in the worked example (with input) here. This tutorial will cover two ways of visualising the modes with VMD, and also discuss the other output files generated as part of the process.

Visualising modes from vector.dump using draw_vector.tcl

For this part of the tutorial you need to ensure that you have available a vector.dump file containing the harmonic normal modes and points.final.xyz. These are both produced in the example linked above. If you are using a potential other than CHARMM or AMBER that does not produce a points.final.xyz, one can be easily created by adding a column of atom names on the left of points.final. file Credit for draw_vector.tcl goes to Szilard Fejer (sf344)

WARNING: This process can run into problems for large systems with many degrees of freedom. This is because VMD is extremely bad at freeing up memory after it has been allocated. If you're unsure about how it will cope, you are advised to load individual normal modes manually as will be described.

Preparing the input for VMD

draw_vector.tcl reads in a modified xyz format that contains extra information, the normalised vector components (allowing the plotting of vectors on each atom) and the scaled atomic displacement caused by that mode. Each file contains 11 frames with coordinates upon which the normal mode has been acted an integer number of times between -5 and +5. You require one of these files for each mode, and they are produced for you by a simple Fortran program, visnormodes.f90 that you can download here. There are a few options that you can set at the top of the source and I recommend you at least look at the possibilities before compiling it. Once you are happy, run the program in the directory containing the output from your OPTIM run. You now have everything you need to visualise the modes - here is a brief list of the output files and what they contain:

  • mag_histo.P - histogram of scaled atomic displacements for mode P. Gives a measure of mode localisation
  • nmode.P.xyz - modified xyz file containing the vector components for mode P and the scaled atomic displacements for 11 frames (see above)
  • modefile - file containing commands for drawvector.tcl allowing automatic read in of all modes. This can be edited freely
  • partratiovsmode.dat - gnuplot data of the participation ratio vs the mode index. This gives another measure of mode localisation
  • partratiovsvibfreq.dat - gnuplot data for participation ratio vs vibrational frequency in wavenumbers
  • vibfreqvsmode.dat - gnuplot data for the vibrational frequency in wavenumbers vs the mode index

For this visualisation, we only need the nmode.P.xyz files. modefile is optional. We now have all the data required to visualise the modes!

Loading files into VMD

Now we have the input files ready - you need a copy of draw_vector.tcl that you can obtain here. Place this file in the directory containing your OPTIM output, and the files created by running visnormodes.f90. Make sure you have the vmd module loaded and start vmd as follows:

vmd
  • open the TCL console from the menu Extensions>TK Console
  • load the draw_vector.tcl code
source draw_vector.tcl
  • load the nmode.P.xyz files

You have a choice here. If your system is small with few modes, you can load them all at once as follows:

source modefile

This will produce a lot of console output of the form:

...
11 frames read for molecule id 12 with number of atoms     48
molstart= -1
...

If you system is sizeable, this will most likely crash VMD as you will run out of memory. You can load individual modes as follows:

initxyz nmode.1.xyz 2.0

This will load mode 1 with an arrow scaling factor of 2.0. If the arrows appear too small, you can of course increase this. As I'm sure you have guessed, modefile just contains a set of these commands generated by the Fortran program.

  • OPTIONAL: change the colour scale from RWB (red->white->blue) to BWR (guess!)

If you'd like to colour the atoms as 'hot and cold' with red being a lot of movement and blue being little, you need to do this manually as it defaults to the opposite. This is done in the Graphics>Colors dialogue box, in the Color Scale tab.

  • visualise the mode you'd like to look at!

If you loaded all the modes from modefile then you can view mode P using the command:

tr P

This will show the mode in action. The modes are numbered from soft->hard so mode 1 is likely to be a very delocalised mode; with many atoms moving (high participation ratio). Note that bonds being broken is really just an artefact of the arbitrary displacement applied by visnormodes.f90. This can be changed in that source code. If you have only loaded a sample of modes manually using initxyz, you can view the Qth mode you loaded in the same way with:

tr Q

One final word on this - if you'd like to look at the mode represented by a static picture in a realistic geometry (i.e. if you're making images for publication), then you should stop the rocking and view frame 6, as this is the original geometry with the vector applied zero times.

Visualising modes from modes.pdb and other OPTIM output pdbs

If you have run the example input detailed here, you will have some extra PDB files in your OPTIM output that you might not have seen before. These include not just the usual structural information, but also two extra columns that contain per-atom and per-residue displacement information as in the nmode.P.xyz files discussed above. The great thing about these PDBs is that they can just be loaded into VMD like any other file - no preparation is required. Depending on which keywords you used, the output files will vary, but for the example linked above, you will get the following:

  • modes.pdb - contains a frame for each mode, starting with the softest
  • totalmodes.pdb - a single frame containing displacement information calculated from a simple vector sum of ALL the normal modes
  • weightedmodes.pdb - a single frame containing displacement information calculated from a Boltzmann weighted (by frequency) vector sum of ALL the normal modes
  • thermalmodes.pdb - a single frame containing displacement information calculated from a Boltzmann weighted (by frequency) vector sum of all modes of frequency less than kT as specified by the KTWN keyword (or using the default, room temperature value).
  • mode.1.pdb, mode.2.pdb etc - a single frame containing displacement information for the mode specified. These files are produced by the DUMPMODE keyword in the data file.

Note that the value of kT used in the weighting is also determined by KTWN.

Viewing the information in modes.pdb using colourmodes-pdb.tcl

colourmodes-pdb.tcl is another script written by Szilard to allow VMD to cope with a multi-framed PDB containing displacement information. If you just try to load modes.pdb into VMD, it only reads the displacement information for frame 1, so you cannot view the effects of all the modes. This script gets round that problem, but like the above - it runs into problems for big systems. If you crash VMD, try the below alternative! First you need to obtain the TCL script here. Move it into the directory containing your OPTIM output. You now need to load vmd, here are the steps:

vmd
  • open the TCL console from the menu Extensions>TK Console
  • load the colourmodes-pdb.tcl code
source colourmodes-pdb.tcl
  • load the modes.pdb file
initpdb modes.pdb
  • OPTIONAL: change the colour scale from RWB (red->white->blue) to BWR (guess!)

If you'd like to colour the atoms as 'hot and cold' with red being a lot of movement and blue being little, you need to do this manually as it defaults to the opposite. This is done in the Graphics>Colors dialogue box, in the Color Scale tab.

  • decide if you'd like to view per-atom or per-residue displacement information

If you're after per-atom:

tr 1 atom

Or for per-residue:

tr 1 res

You can now scroll through the modes by moving the frame slider. You can also change between per-atom and per-residue colouring by simply typing the other command.

This method has two big problems though - firstly is the memory issue i.e. it tends to crash VMD when you try to load modes.pdb for a big system. Also, you cannot change the way the system is displayed which is very frustrating! If you'd like to look at a specific mode, or at one of the other output pdbs described above, you're better off doing it manually as follows.

Viewing the information in single PDBs

If, for example you have used included DUMPMODE 1 in your data file, you will have the file mode.1.pdb in your OPTIM output. This file contains, like modes.pdb, per-atom and per-residue displacement information resulting from the action of that mode. This information is stored in the Occupation and Beta Coloring Method options within VMD when the PDB is loaded. Here is a step by step guide:

  • open the PDB with VMD
vmd mode.1.pdb
  • OPTIONAL: change the colour scale from RWB (red->white->blue) to BWR (guess!)

If you'd like to colour the atoms as 'hot and cold' with red being a lot of movement and blue being little, you need to do this manually as it defaults to the opposite. This is done in the Graphics>Colors dialogue box, in the Color Scale tab.

  • change the Drawing Method to your liking in the Graphics>Representations dialogue box
  • change the Coloring Method to display the displacement information in the Graphics>Representations dialogue box

If you're after per-atom displacement colouring, change the Coloring Method to Occupation

If it's per-residue displacement colouring you'd like, change it to Beta

That's it! Simple eh! Please let me know (csw34) if you find any bugs or if you have any ideas for improvements :)

--csw34 20:27, 7 April 2009 (BST)