Up: Theoretische Chemie, Ruhr-Universität Bochum,Germany http://www.theochem.ruhr-uni-bochum.de/go/cpmd-vmd.html Home:Homepage Axel Kohlmeyer

spiffy wannier functions plot

Visualization and Analysis of Quantum Chemical and Molecular Dynamics Data with VMD

Part 1

bulk water + hydronium

    3. Preparation and Installation Issues

         3.1. Customizing the VMD Setup

         3.2. Predefining Additional Items

         3.3. Extending the Script and Plugin Search Path


    Next: Part 2     Up:Start     Down:Contents



3. Preparation and Installation Issues

Many of the examples presented here utilize the excellent scripting capabilities of VMD and consist in part of reusable subroutines written in the VMD/Tcl dialect. To adapt the VMD scripting examples presented here, you should therefore first have a look at the excellent VMD User's Guide and also get a little bit acquainted with programming in Tcl/Tk. There is a Python scripting interface in VMD as well, but it is not (yet) covered here.

Via the autoloading feature of the Tcl/Tk script engine embedded in VMD users can have a repository of Tcl subroutines which will be loaded on demand. This way you don't have to copy the files into every single VMD script and you can update your scripts by just replacing the files in the repository (of course only as long as the calling sequence stays intact).


3.1. Customizing the VMD Setup

If you want to change some of the default settings of VMD you can put the necessary commands into a file named .vmdrc in your home directory. Note, that using a personal .vmdrc file turns off loading the default .vmdrc file from the VMD installation directory, so it is usually a good idea to start customizing VMD by copying the default .vmdrc file to your home directory and modifying it. For example I do prefer orthographic projection, a grey background, green carbon atoms and light green flourine atoms. This is achieved by putting the following code into your ~/.vmdrc:

 
# make sure, that the main menu is active
menu main on

# modify display settings
display projection orthographic
axes location off
color Display Background silver

# redefine some colors
color Name C green
color Name F lime
color Type C green
color Type F lime
 

3.2. Predefining Additional Items

The graphical user interface of VMD has a selection of predefined parameters (materials, color schemes, etc.) that you can use for objects on your screen. You can create additional ones interactively, but you can also create them in your startup script so that they are always available. For example if you want to have a material 'Glass' that is much more transparent than the default 'Transparent' material, then add the following code to your ~/.vmdrc:

 
# define a new, very transparent material 'Glass'
material add Glass
material change ambient   Glass 0.00
material change specular  Glass 0.50
material change diffuse   Glass 0.65
material change shininess Glass 0.53
material change opacity   Glass 0.15
 

3.3. Extending the Script and Plugin Search Path

In order to make libraries of additional Tcl scripts (=subroutines) or plugins (e.g. for reading trajectories in a new, yet unsupported format) available to VMD you can also put some code in your ~/.vmdrc file. The following example assumes that you have created a directory vmd in your home directory and therein the following subdirectories scripts, scripts/tcl, scripts/extensions, and plugins:

 
# search for new/updated molfile plugins in $HOME/vmd/plugins/$VMDARCH/molfile
# type 'vmdinfo arch' to find your name for $VMDARCH
vmd_plugin_scandirectory [file join $env(HOME) vmd/plugins [vmdinfo arch] molfile] *.so

# add local (autoloaded) scripts to the search path
set auto_path [concat $env(HOME)/vmd/scripts/tcl $auto_path]

# command extensions (e.g. vmd_draw_vector) have to be sourced
foreach ext [glob -nocomplain $env(HOME)/vmd/scripts/extensions/*.tcl ] {
        source $ext
}
unset ext
 

The complete .vmdrc file is also available for download. A Collection of several VMD script extensions , custom plugins and so on, can be found in the Tips and Tricks part of this tutorial.


Up:Top of Page     Next: Part 2     Up:Start     PDF version of this document.

Full Table of Contents


1. Introduction
     1.1. About this Tutorial
     1.2. About the Programs
     1.3. Notes
     1.4. Citation / Bookmark
     1.5. Recent Changes
2. Table of Contents
3. Preparation and Installation Issues
     3.1. Customizing the VMD Setup
     3.2. Predefining Additional Items
     3.3. Extending the Script and Plugin Search Path
4. Loading and Displaying Configurations and Trajectories
     4.1. Loading a Single Geometry
     4.2. Creating a Visualization
     4.3. Saving and Re-using a Visualization
     4.4. Viewing a Trajectory
     4.5. How to Show Breaking and Formation of Bonds
     4.6. Adding Graphics to a Visualization
5. Adding Dynamic Graphics to a Trajectory
     5.1. Adding a Progress Bar for the Elapsed Time
     5.2. Display the Total Dipole Moment of the Simulation Cell
     5.3. Visualizing Changing Atom Properties with Color
     5.4. Modify an Atom Property Dynamically from an External File
6. Dynamic Atom Selection
     6.1. Display a Changing Number of Molecules
     6.2. Keeping Atoms or a Molecule in the Center and Aligned
     6.3. Modify a Selection During a Trajectory
     6.4. Using the User Field for Computed Selections
     6.5. Tracing a Dynamic Property
7. Visualizing Volumetric Data from Cube-Files
     7.1. Electron Density and Electrostatic Potential
     7.2. Canonical and Localized Orbitals
     7.3. Electron Localization Function (ELF)
     7.4. Manipulation of Cube Files / Response to an External Potential
     7.5. Bulk Systems
     7.6. Animations with Isosurfaces
     7.7. Volumetric data from Gaussian
8. Using Data Processing to Tailor Data for VMD
     8.1. Visualizing Path-Integral Trajectories
     8.2. Extracting the Geometry Information from old CPMD Output Files
     8.3. Removing Unneeded Parts From a Cube File
     8.4. Extract Some Coordinates with Bounding Box Information
     8.5. Creating 3d-Ramachandran Histograms
9. Misc Tips and Tricks
     9.1. Collected 'draw' Extensions
     9.2. Using a Different Default Visualization
     9.3. Changing the Default vdW Radii
     9.4. Reloading the Current Trajectory
     9.5. Visualize a Trajectory With a Changing Number of Atoms or Bonds
     9.6. Set the Unit Cell Information for a Whole Trajectory
     9.7. Directly Print the Current Visualization
     9.8. Transferring a Visualization from a Molecule to Others
     9.9. Adding a TCL-Plugin to the Extensions Menu
     9.10. Turn Off Output in Analysis Scripts
     9.11. Automatically Turn on TCL mode in (X)Emacs for .vmd Files
10. Credits
11. Downloads
12. Script distribution policy


Up: Theoretische Chemie, Ruhr-Universität Bochum,Germany http://www.theochem.ruhr-uni-bochum.de/go/cpmd-vmd.html Home:Homepage Axel Kohlmeyer

Website META Language Disclaimer   /   E-mail to the webmaster of this hompage: webmaster@theochem.ruhr-uni-bochum.de
Source File: index.wml (Thu Aug 25 19:02:51 2005) ($Revision: 1.44 $) Translated to HTML: Mon Oct 10 00:05:54 2005