You are on page 1of 194

VMD User's Guide

A. Dalke, J. Gullingsrud, W. Humphrey, S. Izrailev, J. Stone, J. Ulri h

Version 1.4

January 6, 2000

1
Theoreti al Biophysi s Group

University of Illinois and Be kman Institute

405 N. Mathews

Urbana, IL 61801

VMD WWW home page: http://www.ks.uiu .edu/Resear h/vmd/

Des ription
The VMD User's Guide des ribes how to run and use the mole ular visualization and analy-
sis program VMD. This guide do uments the usage of both the graphi al user interfa e and the
text onsole interfa e for displaying and grapi ally manipulating mole ules, and des ribes how to
ustomize the appearan e and behavior of VMD for ea h user.

1
http://www.ks.uiu .edu/
Contents

1 Introdu tion 10
1.1 For more information on VMD and MDS ope . . . . . . . . . . . . . . . . . . . . . . 11
1.2 Conta ting the authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3 Credits and Program Referen e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4 Copyright and Dis laimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.5 Registering VMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.6 A knowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Tutorials 14
2.1 Rapid Introdu tion to VMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Viewing a mole ule: Myoglobin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3 Rendering an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4 A Qui k Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 An Introdu tion to Atom Sele tion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6 Comparing Two Stru tures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 User Interfa e Components 19
3.1 Using the Mouse in the Graphi s Window . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.1 The Popup Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.2 Atom/Mole ule Spe i Popup Menu . . . . . . . . . . . . . . . . . . . . . . 29
3.1.3 Delete Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.1.4 Hot Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2 Using the Forms library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2.1 Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2.2 Sliders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.2.3 Choosers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.2.4 Text Entry Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.2.5 Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2.6 File Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3 Des ription of ea h VMD form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3.1 Main Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3.2 Mole ules (Mol) Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.3.3 Files Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3.4 Graphi s Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3.5 Animate Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.3.6 Edit Animation Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

2
3.3.7 Labels Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.3.8 Display Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.3.9 Color Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.10 Render Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.3.11 Tra ker Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.12 Sim Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.4 Other User Interfa es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.4.1 External Interfa es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4 Loading A Mole ule 62
4.1 Babel interfa e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.2 What happens when a le is loaded? . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3 Raster3D le format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.4 Raster3D Caveats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5 Mole ular Drawing Methods 65
5.1 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.2 Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.3 CPK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.4 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.5 VDW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.6 Dotted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.7 Solvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.8 Tube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.9 Tra e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.10 Li ori e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.11 Ribbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.12 Surf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.13 Cartoon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.14 MSMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.15 HBonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.16 O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6 Coloring Mole ules and Obje ts 73
6.1 Color ategories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.2 Coloring Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.2.1 Coloring by olor ategories . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.2.2 Color s ale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.3 Transparen y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.4 VMD S ript Commands for Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.4.1 Adjusting the degree of transparen y . . . . . . . . . . . . . . . . . . . . . . . 77
6.4.2 Changing the olor s ale de nitions . . . . . . . . . . . . . . . . . . . . . . . 78
6.4.3 Creating a set of bla k-and-white olor de nitions . . . . . . . . . . . . . . . 79
6.4.4 Revert all RGB values to defaults . . . . . . . . . . . . . . . . . . . . . . . . 80
6.4.5 Setting the transparent olors a ording to solid . . . . . . . . . . . . . . . . 80
6.4.6 Making the mole ule to show up slowly . . . . . . . . . . . . . . . . . . . . . 80
6.4.7 Querying VMD for Color Information . . . . . . . . . . . . . . . . . . . . . . 81

3
7 VMD Atom Sele tion Language 82
7.1 De nition of Keywords and Fun tions . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.2 Boolean Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.3 Short Cir uiting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.4 Quoting with Single Quotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.5 Double Quotes and Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.6 Comparison sele tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.7 Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.8 Other sele tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.8.1 sequen e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.8.2 within and same . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.9 Referen ing T l data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.9.1 $referen es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.9.2 referen es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.9.3 The di eren es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
8 Creating Output Raster Images 92
8.1 Creating an Output Image File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
8.2 Known Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
8.3 One Step Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
9 Viewing Modes 95
9.1 Perspe tive/Orthographi views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.2 Monos opi Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.3 Stereos opi Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.3.1 Side-By-Side and Cross-Eyed Stereo . . . . . . . . . . . . . . . . . . . . . . . 96
9.3.2 Crystal Eyes Stereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.3.3 Problems with stereo on Indigo2 ma hines . . . . . . . . . . . . . . . . . . . . 97
9.3.4 Stereo Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
9.4 Making Stereo Raster Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
10 Text User Interfa e 99
10.1 Using text ommands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
10.2 T l/Tk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.3 Core Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.3.1 animate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.3.2 axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
10.3.3 olor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.3.4 olorinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.3.5 debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
10.3.6 display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
10.3.7 e ho . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.3.8 exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.3.9 external . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.3.10 help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.3.11 imd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.3.12 label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

4
10.3.13 light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
10.3.14 log le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
10.3.15 menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
10.3.16 mol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
10.3.17 mole ule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
10.3.18 mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
10.3.19 play . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
10.3.20 quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
10.3.21 imd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
10.3.22 render . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
10.3.23 ro k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.3.24 rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.3.25 s ale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
10.3.26 sim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
10.3.27 simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
10.3.28 stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
10.3.29 tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.3.30 translate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.3.31 user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
10.3.32 vmdlog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.3.33 vmdinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.3.34 wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.3.35 sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
11 Ve tors and Matri es 117
11.1 Ve tors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
11.2 Matrix routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
11.3 Multiplying ve tors and matri es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
11.4 Mis . fun tions and values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12 User-De ned Graphi s 125
12.1 Introdu tion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
12.2 Tutorials and Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
12.2.1 Drawing a graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
12.2.2 Triangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
12.2.3 Draw a surfa e plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.2.4 Drawing a box around a mole ule . . . . . . . . . . . . . . . . . . . . . . . . . 131
12.2.5 Adding a label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
12.2.6 Interfa e to pi king . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
12.2.7 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
12.3 Graphi s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
12.4 Draw and Drawing Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
13 Mole ular information: molinfo and atomsele t 138
13.1 molinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
13.1.1 Using molinfo to a ess the mole ule list . . . . . . . . . . . . . . . . . . . . 138
13.1.2 Using molinfo to a ess information about a mole ule . . . . . . . . . . . . . 139

5
13.2 Atom information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
13.3 Analysis s ripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
14 Tips and Tri ks 152
14.1 Customizing the Popup Menu and the Hot Keys . . . . . . . . . . . . . . . . . . . . 152
14.1.1 Customizing the popup menu . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
14.1.2 Customizing the Hot Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
14.1.3 Automati ally loading ustomization ommands . . . . . . . . . . . . . . . . 154
14.2 Using VMD as a WWW Client (for hemi al/* do uments) . . . . . . . . . . . . . . 155
14.2.1 MIME types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.2.2 Setting up your .mail ap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.2.3 Example sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.3 Making a Movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
14.4 Coloring Tri k - Override a Coloring Category . . . . . . . . . . . . . . . . . . . . . . 157
14.5 Some Ni e Represenations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
14.6 Finding Conta t Residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
14.7 T l Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
14.8 Remote Control of VMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
14.9 Controlling One VMD With Another . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
15 Intera tive Mole ular Dynami s 160
15.1 How the Conne tion Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
16 Advan ed S ript Writing 162
16.1 Drawing a distan e matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
16.2 Analysis of PDB les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
16.3 save/load VMD state information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
16.4 Currently pi ked mole ule/atom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
16.5 Tra e on the pi k variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
16.5.1 Information about the pi ked atom . . . . . . . . . . . . . . . . . . . . . . . . 169
16.5.2 Making a sphere appear when an atom is pi ked . . . . . . . . . . . . . . . . 170
16.5.3 Drawing a line from the eye to the pi ked atom . . . . . . . . . . . . . . . . . 170
16.6 Traje tory frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
16.6.1 Animating the se ondary stru ture . . . . . . . . . . . . . . . . . . . . . . . . 171
16.6.2 Viewing sele tions whi h hange during an animation . . . . . . . . . . . . . 173
16.6.3 Simulation frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
16.7 RMSD and best- t alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
16.7.1 RMSD Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
16.7.2 Computing the Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
16.7.3 A simulation example s ript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
17 Customizing VMD Sessions 180
17.1 Command-Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
17.2 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
17.3 Startup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
17.3.1 Core S ript Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
17.3.2 User S ript Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

6
17.3.3 .vmd init File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
17.3.4 .vmdr File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
18 Future Plans 186
Index 188

7
List of Figures
2.1 Sample VMD session displaying myoglobin. . . . . . . . . . . . . . . . . . . . . . . . 15
3.1 Simple buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 A ommon button motif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.3 Sliders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.4 Choosers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5 A Text Entry Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.6 Several Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.7 The File Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.8 The Main form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.9 The Mole ules form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.10 The Files form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.11 The Graphi s form (in Image Controls mode) . . . . . . . . . . . . . . . . . . . . . . 56
3.12 The Graphi s form (in Atom Name Lists mode) . . . . . . . . . . . . . . . . . . . . . 57
3.13 The Animate form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.14 The Edit Animation form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.15 The Labels form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.16 The Display form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.17 Relationship between s reen height (SCRHEIGHT), s reen distan e to origin (SCRDIST),
and the viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.18 The Color form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.19 The Render form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.20 The Tra ker form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.1 RGB olor s ale: the three plots shows the ontributions of ea h olor, and the
resulting olors are on the bottom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.2 The shift to the red omponent of the RGB s ale aused by the value of \min". . . . 79

8
List of Tables
3.1 Mouse ontrol hot keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2 Rotation & s aling hot keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.3 Menu ontrol hot keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.4 Animation hot keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.1 Mole ular view representation styles. . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.1 Color ategories used in VMD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.2 Mole ular oloring methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.3 Available Color S ale Gradations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.1 Atom sele tion keywords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
7.2 Atom sele tion keywords ( ontinued). . . . . . . . . . . . . . . . . . . . . . . . . . . 90
7.3 Atom sele tion fun tions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.4 Regular expression methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.5 Regular expression onversions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
8.1 Supported output rendering formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
10.1 Summary of ore text ommands in VMD. . . . . . . . . . . . . . . . . . . . . . . . . 101
10.2 On-line Help Sour es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
13.1 molinfo keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
13.2 atomsele t keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

9
Chapter 1

Introdu tion
VMD is a mole ular graphi s program designed for the intera tive visualization and analysis of
biopolymers su h as proteins, nu lei a ids, lipids, and membranes. Currently VMD runs on
SGI workstations with IRIX 5.3 or higher, Hewlett-Pa kard workstations with HP-UX 10.20, Sun
workstations with Solaris 2.6 or higher, IBM RS/6000 workstations with AIX 4.2 or higher, PC's
running Linux, and PC's running Windows 95/98/NT.
Online information about VMD is available from http://www.ks.uiu .edu/Resear h/vmd/.
VMD has several features:
 General mole ular visualization
At its heart, this program is a general appli ation for displaying mole ules ontaining any
number of atoms. It is similar in basi apabilities to ommer ial programs su h as Quanta
and non- ommer ial programs su h as RasMol, XMol, and Ribbons. It an read PDB les
or use Babel (if available) to onvert other formats automati ally. On e loaded, user-de ned
subsets of the mole ule an be displayed in various ways in luding li ori e, ribbons, van der
Waal spheres, and mole ular surfa es. The display an be saved dire tly to a posts ript le or
in a format suitable for use by ray tra ing programs su h as Raster3D, POV, and Rayshade.
 Visualization of dynami mole ular data
VMD an read mole ular traje tories from DCD and Amber les, or it an a quire timesteps
from a running mole ular dynami s program. The data an be used to animate the mole ule
or to plot the hange in mole ular properties su h as interatomi distan es, angles, or dihedrals
over time.
 Display and ontrol of mole ular dynami s simulations
VMD an be used as a graphi al front end to a mole ular dynami s (MD) program running
on a remote super omputer or high-performan e workstation. VMD an intera tively display
and ontrol the MD simulation as the simulation is running. The user an dis onne t from
the simulation and let it ontinue, reatta h to a running simulation, or halt the MD program.
 Support for several input and display (output) devi es
A number of di erent visual display and ontrol systems are supported in addition to the
usual monitor, keyboard, and mouse. The UNC tra ker library is used to get position and
orientation information from a wide variety of spatial input devi es, in luding a Polhemus
Fastrak. An interfa e to the CAVE library has been developed for use in many di erent types
of stereo proje tion fa ilities.

10
 T l s ripting language
VMD uses the freely available T l s ripting language for pro essing text ommands. This is
a very ommon and popular language whi h ontains variables, loops, subroutines, and mu h
more. The T lX and T l-DP extension pa kages have been in luded to improve the usefulness
of the language.
 Mole ular analysis ommands
Many new T l ommands have been added for doing mole ular analysis. These in lude
methods to extra t information about a set of atoms and mole ules, ve tor and matrix routines
for oordinate manipulation, and fun tions for omputing values like the enter of mass and
radius of gyration.
VMD is the visualization omponent of MDS ope, a omputational environment for stru tural
biology and intera tive mole ular dynami s.

1.1 For more information on VMD and MDS ope


MDS ope (a Mole ular Dynami s omputational environment) is a omplete software environment
for intera tive simulation and display of biopolymers. It onsists of three omponents:
 VMD
A general mole ular visualization program apable of intera tive display and on urrent
ontrol of a mole ular dynami s simulation running on a remote omputer. VMD uses an
obje t-oriented design, and is written in C++. This do ument des ribes the VMD omponent
of MDS ope.
 NAMD
A parallel, obje t-oriented mole ular dynami s ode designed for high-performan e simula-
tion of large biomole ular systems. NAMD uses the CHARMM for e eld and le formats
ompatible with both CHARMM and X-PLOR. NAMD supports both periodi and non-
periodi boundaries with eÆ ient full ele trostati s, multiple timestepping, onstant pressure
and temperature ensemble simulation methods. NAMD provides several methods of steering
a simulation through the appli ation of additional for es, in luding the ability to onne t
dire tly to VMD for intera tive steering of a live simulation. NAMD is distributed free of
harge and in ludes sour e ode.
For more information on MDS ope, or on any of the individual omponents VMD, or NAMDsee
the Theoreti al Biophysi s Group WWW home page1 . Full sour e ode and do umentation for all
omponents of MDS ope may be obtained from the Theoreti al Biophysi s Group anonymous FTP
server2 , in the dire tory pub/mds ope.

1.2 Conta ting the authors


The urrent authors of VMD are Justin Gullingsrud and John Stone. We are very interested in and
grateful for any user omments and reports of program bugs or ina ura ies. If you have any sugges-
tions, bug reports, or general omments about VMD, please send them to us at vmdks.uiu .edu.
1
http://www.ks.uiu .edu/
2
ftp://ftp.ks.uiu .edu/

11
1.3 Credits and Program Referen e
The authors request that any published work or images reated using VMD in lude the following
referen e:

Humphrey, W., Dalke, A. and S hulten, K., \VMD - Visual Mole ular Dynami s" J. Mole .
Graphi s 1996, 14.1, 33-38.
VMD has been developed by the Theoreti al Biophysi s group at the University of Illinois and
the Be kman Institute. The main authors of VMD are A. Dalke, J. Gullingsrud, W. Humphrey,
S. Izrailev, J. Stone, J. Ulri h. This work is supported by grants from the National Institutes of
Health (grant number PHS 5 P41 RR05969-04), the National S ien e Foundation (grant number
BIR-9423827 EQ), and the Roy J. Carver Charitable Trust.

1.4 Copyright and Dis laimer


VMD is Copyright
1995-1999 Theoreti al Biophysi s Group and the Board of Trustees of the
University of Illinois

Portions of this ode are opyright


1997-1998 Andrew Dalke.

The terms for using, opying, modifying, and distributing VMD are spe i ed by the VMD
Li ense. The li ense agreement is distributed with VMD in the le LICENSE. If for any reason
you do not have this le in your distribution, it an be downloaded from:
ftp://ftp.ks.uiu .edu/pub/mds ope/vmd/LICENSE
Some of the ode and exe utables used by VMD have di erent restri tions. They are:
1) STRIDE, the program used for se ondary stru ture al ulation, is free to both a ademi
and ommer ial sites provided that STRIDE will not be a part of a pa kage sold for money. The
use of STRIDE in ommer ial pa kages is not allowed without a prior written ommer ial li ense
agreement. See http://www.embl-heidelberg.de/argos/stride/stride info.html
2) The sour e ode for SURF is opyrighted by the original author, Amitabh Varshney, and
the University of North Carolina at Chapel Hill. Permission to use, opy, modify, and distribute
this software and its do umentation for edu ational, resear h, and non-pro t purposes is hereby
granted, provided this noti e, all the sour e les, and the name(s) of the original author(s) appear
in all su h opies.
BECAUSE THE CODE IS PROVIDED FREE OF CHARGE, IT IS PROVIDED "AS IS" AND
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED.
This software was developed and is made available for publi use with the support of the
National Institutes of Health, National Center for Resear h Resour es under grant RR02170.
See ftp://ftp. s.un .edu/pub/proje ts/GRIP/SURF/surf.tar.Z .
3) The perl s ript url get, was written by Ja k Lund at the University of Texas as Austin. There
appear to be no restri tions on its use.

12
1.5 Registering VMD
VMD is made available free of harge for non- ommer ial use to all interested users (but please see
the Dis laimer below). We would like to request that you register with us that you are using VMD.
This is so that we an maintain some idea of the number of users of the program and so that we
know who to onta t about program updates, bug xes, et . To register, please ll out the form at
http://www.ks.uiu .edu/Resear h/vmd/VMDregistration.html.
We appre iate your help in this servi e.

1.6 A knowledgments
The authors would parti ularly like to thank those individuals who have ontributed improvements
to VMD in the form of new features or entire repla ement odes for old features. Spe ial thanks go
to Andrew Dalke, Paul Grayson, and Charles S hwieters for their VMD ontributions. The entire
VMD user ommunity now bene ts from your ontributions.
The authors would like to thank the members of the Theoreti al Biophysi s group, past and
present, who have helped tremendously in making suggestions, pushing for new features, and trying
out quite often very bug-ridden ode. Tom Bishop, the original (and for some time only) VMD
user, has been a driving for e in suggesting (well, demanding) new features and bug xes. As well,
thanks go to Alexander Balae , Ivo Hofa ker, Xi he Hu, Barry Israeliwitz, Dorina Kosztin, Ilya
Logunov, Jim Phillips, Ari Shinozaki, Svilen Tzonev, Willy Wriggers, Dong Xu, Feng Zhou, and
our agent in the eld, Daniel Barsky. Thanks also to all of you who have tried out the program.
Many external libraries and pa kages are used in VMD, and the program would not be possible
without them. The authors wish to thank Jon Lee h for the ode to ompute the uniform point
distributions; T. C. Zhao and Mark Overmars, authors of the ex ellent XFORMS library; John
Ousterhout and the other authors of the T l, Tk, T lX, TkX and T l-DP pa kages; the authors
of the VRPN library from the University of North Carolina; Amitabh Varshney, author of SURF,
also from UNC; Dmitrij Frishman at EMBL for developing STRIDE; Ja k Lund for the url get
perl s ript; and Ethan Merrit from the University of Washington for developing the algorithm for
drawing ribbons.
We also re eived invaluable assistan e from people who got the sour e ode and sent in pat hes
and expli it bug reports. The VMD developers would like to thank Axel Berg, Andrew Dalke,
Ri k Kufrin, Joe Landman, Clare Ma rae, Lukasz Salwinski, Stephen Searle, Charles S hwieters,
Mi hael Tiemann, Raymond de Vries, and Simon War eld for their bug xes and orresponden e.

13
Chapter 2

Tutorials
2.1 Rapid Introdu tion to VMD
For those of you who don't like reading the manual, here is a qui k introdu tion to VMD. To start it
type vmd on the ommand line of your shell. (If that doesn't work, make sure it is in your path; you
may have to he k with your system administrator about how to x it). VMD should start up in
a window titled vmd onsole, a display window entitled OpenGL Display, and a button bar entitled
main. Text ommands are typed in the onsole window, graphi s are displayed and manipulated
in the display window, and many ommands are available from the menu interfa e, a essible
through the button bar. (The menus are based on the Forms library so all future referen es in the
do umentation will refer to them as forms and not menus.) All the forms an be turned o by
pressing the button in the enter top; for instan e, press the button labeled VMD in the main form
to turn it o .
There are two ways to perform almost all fun tions in VMD, either use the forms or the text
onsole. For many of the ommands, you an also use the popup menu available in the display
window by pressing the right mouse button. Some of the more sophisti ated ommands, su h as
T l s ripting, are only available in the text interfa e. Now that the button bar is turned o , you
probably will want it ba k. The easiest way to a ess any form is by pla ing the ursor in the
display window and holding down the right button on the mouse to obtain a popup menu. Sele t
the option `show form' on the popup menu, and then sele t the form `main'. The button bar should
reappear. The same e e t may be a omplished by typing the ommand menu main on in the text
onsole window.

2.2 Viewing a mole ule: Myoglobin


You have probably obtained VMD in order to visualize mole ules, so we'll load up one of the
provided mole ular stru tures to demonstrate the apabilities of VMD. On the button bar, li k on
the Mol button. This brings up the Mole ules form [x3.3.2℄. (As before, this form may be turned
o by li king the button in the enter top of the form, labeled Mole ules). Sele t Load From Files
on the Mole ules form to bring up the Files form [x3.3.3℄.
We will load a PDB (Protein Data Bank) le ontaining the oordinates of the atoms in myo-
globin ( ompliments of Joel Berendzen from the Biophysi s Group at Los Alamos National Lab-
oratory). In the browser on the left, sele t the line that says pdb only then li k on the button
labeled Sele t pdb. Use the le browser that appears to go to the subdire tory proteins/ of

14
the VMD distribution (you may have to ask where this is lo ated; try /usr/lo al/lib/vmd or
/usr/lo al/vmd). On e there, sele t the le mb o.pdb. (Be areful when hanging dire tories as
the Forms library does not understand double li ks, and li king too rapidly may ause the form
to get very upset and ore dump. This problem will be xed in future versions of VMD.) On e the
PDB le is sele ted, li k on the Load Mole ule button in the enter of the Files form. You have
loaded a myoglobin stru ture. Figure 2.1 shows an example of VMD displaying this protein.

Figure 2.1: Sample VMD session displaying myoglobin.

You an use the mouse to manipulate the stru ture in the display window. There are three
basi mouse modes [x3.1.1℄: rotation[x3.1.1℄, translation [x3.1.1℄, s aling[x3.1.1℄. The mode an be
hanged from the display window popup menu by pressing the right mouse button and pi king
the option under `Mouse Mode', or by pressing r, t, or s on the keyboard. Experiment with these
modes, and note how the ursor hanges to indi ate the urrent mode. In rotation mode, the left
mouse button ontrols rotation about axes parallel to the s reen, and the middle button ontrols
rotation about the axis perpendi ular to the s reen. In translation mode, the left mouse button
ontrols translation parallel to the s reen, while the middle button ontrols translation in and out
of the s reen. Finally, in s aling mode, both the left and middle buttons ontrol global s aling
when the mouse is moved left or right, but the middle button auses larger hanges. In all modes,
the right mouse button ontrols the display window popup menu.
By default the myoglobin bonds are represented as lines and non-bonded atoms as points, with
the olor in both ases representing the atom type. This representation is easy for the omputer
to draw but is not always informative, espe ially when there are a large number of atoms. VMD
allows you to display many of the ommon mole ular representations. To a ess these, open the
Graphi s form [x3.3.4℄ using the button bar.
Suppose you would like to view the myoglobin stru ture with its protein ba kbone represented
as a tube, the heme represented as li ori e, the S O4 ion and C O mole ule represented as van der
Waals spheres, and histidines 64 and 93 represented as CPK models. First, type ba kbone in the
atom sele tion text entry area and press 'enter' to sele t the myoglobin ba kbone. All of the

15
protein ex ept for the ba kbone will disappear. Choose drawing method `Tube' from the drawing
method hooser to render the ba kbone as a tube, and hose oloring method `Ba kbone' from the
oloring method hooser to olor the tube with the prede ned ba kbone olor. Cli k on the Create
New button. This auses a new line to appear on the browser identi al to the rst line. The new
line an be hanged without a e ting the rst one, so lear the atom sele tion text area and then
enter resname HEM to sele t the heme. At this point the heme isn't visible be ause it annot be
drawn as a tube, so hoose the `Li ori e' drawing method to make it appear. Cli k on Create
New again to make a new view, and enter resname SO4 CO to sele t the S O4 ion and the C O
mole ule, and hoose the drawing method `VDW' to render them as Van der Waal spheres. On e
again, press the Create New button and enter resid 93 64 to sele t the two histidines, and render
them as `CPK'. If you followed all that, then ongratulations, you have made a beautiful image of
myoglobin! Many more ways to represent atoms are possible. Please experiment with the options
available in the Graphi s form.

2.3 Rendering an Image


This tutorial assumes Raster3D is installed on your system and the exe utable render is in your
path.
Find an interesting view of the mole ule from the previous tutorial. Suppose you want to publish
this view in a journal and want a high quality image, or you want to make a large poster. Taking
the image from a s reen apture results in a rather grainy image as the size of the pixels be omes
apparent, so you want something with more resolution. There are several programs available whi h
an render a high-quality raster image, based on an input s ript. VMD has the option to reate
input s ripts for many of these image pro essing programs, whi h may then be pro essed to reate
a higher quality image of the s ene displayed by VMD at the time the s ript was reated. See the
se tion on rendering [x 8℄ for a further des ription of how this works.
Open the Render form [x 3.3.10℄ and li k on the `Raster3D' Output Format. Both of the
text boxes will ll with default values and do not need to be hanged. Press the Go button. If
everything works orre tly, a message starting with:
Info 1) Rendering urrent s ene to 'plot.r3d' ...
Info 1) Raster3D file generation finished
Info 1) Exe uting post-render md ' render < %s -sgi %s.rgb; ipaste %s.rgb' ...
Raster3D rendering program V2.0 Apr 1994
will appear in the text onsole. After a few moments, a window should open with an image similar
to the one in the VMD display. This image is in the RGB graphi s format and an be read by
many programs (su h as xv and ipaste).

2.4 A Qui k Animation


Another strength of VMD lies in its ability to playba k traje tories resulting from mole ular dynam-
i s simulations. A sample traje tory, alanin.DCD is provided in the proteins dire tory in luded
with VMD. To load it, li k on the Mol button of the button bar to bring up the Mole ules form
[x3.3.2℄. Next li k on the Load From Files button and sele t the psf and d d option under the
Mole ule File Types listing. Sele t alanin.psf for the psf le and alanin.DCD for the DCD by
li king on the Sele t psf and Sele t d d buttons respe tively. After this, you need only li k the

16
Load Mole ule button in order to begin reading the traje tory. In the display window you should
see a simulation of an alanin residue in va uo. It isn't parti ularly informative, but you an easily
see that the stru ture is quite unstable in an isolated environment. After the DCD le has loaded,
it will by default stop. To see it again or to ne- tune playba k, open the Animate form [x3.3.5℄
by li king on the appropriate button in the button bar. Press the button that looks like >> to
play the animation. Use the slider at the bottom of the form to hange the speed of playba k. By
rotating the mole ule around, et . you should get an idea about how the system destabilizes over
the ourse of the simulation.

2.5 An Introdu tion to Atom Sele tion


In this se tion it is assumed that you have the myoglobin stru ture mb o.pdb loaded and the views
dis ussed in 2.2 reated. If this is not true, go ba k to 2.2 and repeat the pro ess des ribed there.
VMD has a powerful atom sele tion method whi h is very helpful when generating attra tive,
informative, and omplex graphi s. In the previous se tion you used a few of these atom sele tion
tools. This tutorial assumes that you have already loaded the myoglobin mole ule, but it isn't
ne essary to re reate all the graphi al representations.
To hange whi h atoms are used to display ea h representation of the mole ule shown in the
display window, open the Graphi s form [x 3.3.4℄ and sele t the representation you want to hange.
You an then either edit the di erent elds (sele tion, oloring method, or drawing method) or use
the Delete button to delete the view entirely. Try hanging or deleting some of the views. When
nished, delete all representations for the myoglobin stru ture. To get the basi line drawing view
ba k, lear the atom sele tion text entry area (press Es ), enter all and press the Create New
button.
Atoms may be sele ted on the basis of a property, i.e. protein or not protein, water, or
nu lei ba kbone. They may also be sele ted by atom name, su h as atom C, by residue name,
su h as resname HEM, or by many other identi ers. Multiple atoms may be spe i ed with one key-
word. For example, the sele tion name C CA N O will sele t the ba kbone atoms. (A similar e e t
may be obtained with the ommand protein ba kbone.) VMD an handle regular expressions,
so that name "C.*" will sele t all atoms with names starting with C. VMD also understands the
boolean operators and, or, and not, so the sele tion resname HEM and not name "N.*" sele ts all
non-nitrogen atoms in the heme group of myoglobin.
Several more abstra t sele tion riteria are available. For instan e, the sele tion x > 5 nds all
atoms with an x oordinate greater than 5, while mass >12 and mass < 14 sele ts all atoms with
mass greater than 12 and less than 14 atomi mass units. Many math fun tions are also provided, so
the sele tion sqrt( sqr(x) + sqr(y) + sqr(z) ) < 10 will sele t atoms in a spheri al region
of radius 10 A entered about the origin of the oordinate spa e. You an pi k atoms nearby
a sele tion with the phrase \within <distan e> of <sele tion>" and all residues with the same
property as a given sele tion as \same <property> as <sele tion>".
See se tion x 7 for a full des ription of the sele tion ommand.

2.6 Comparing Two Stru tures


Let's start from s rat h by deleting everything: open the Mol form [x 3.3.2℄, sele t every line in the
browser (there should be only one), and press the Delete button.

17
Start by loading the mb o.pdb stru ture with the Files form. Turn on just the heme, CO, and
histidines by using the sele tion ommands resname HEM CO or resid 64 93. The dot (probably
green) in the middle is the iron and you an verify that by li king on it with the mouse. The label
HEM154:FE should appear both on the display and in the text onsole.
To get the distan e between the iron and the oxygen of the CO, li k with the middle mouse
button rst on the iron and then on the oxygen. The rst li k turned the FE label o and the
se ond turned the O label on and drew a line between the two atoms with the distan e drawn in
the middle and a bit to the right. The distan e between the two atoms is 2.94  A, as ompared
to 2.93 
A in the paper; not bad. However, pi king the distan e between the FE and the C of the
CO reveals a distan e of 1.91  A as ompared to 1.85 
A in the paper. The di eren e is that the
stru tures in the VMD distribution are a tually preliminary stru tures obtained before the nal
oordinates were determined.
In order to experiment with more omplex pi king modes, onsider the angle made by the O
of the CO with the FE of the heme and the NE2 of residue 93 (you an li k on the atoms to nd
whi h ones are whi h). Using the right mouse button in the Display window, sele t `Mouse Mode',
then `Pi k Item', then `Angles.' This should ause the ursor to be ome a red rosshair. Cli k on
ea h of the three atoms. After the third pi k, a shallow angle will appear indi ating an 8.71 degree
angle between the three atoms.
Now load the intermediate star.pdb le whi h an also be found in the proteins dire tory of
your distribution. Again use the Files form to do this. Both of the mole ules will be loaded side by
side. Go to the Graphi s form and hange the sele tion so it the same as the rst, i.e. resname HEM
CO or resid 64 93. The two mole ules are almost atop ea h other, making it hard to distinguish
the two, so hange the olors to simplify things.
First, in the Graphi s form, hange the Coloring method to `Mole ule'. Use the Sele ted Mole ule
hooser to hange the mb o.pdb Coloring method to `Mole ule' as well. Open the Color form [x3.3.9℄
and s roll the Category browser down until the line `Mole ule' is visible. Cli k on it then li k
on the line whi h says mb o.pdb. (There may be two mb o lines if the le had been loaded before
in this session.) S roll the Colors browser up to li k on `blue'. This should hange one of the
mole ules in the display to blue.
Next, li k on the last line in the Names hooser, whi h says star.pdb. This time, hoose `red'
from the Colors hooser. The display should be mu h easier to understand. The myoglobin with
the bound CO is in blue and the intermediate state is in red. At this point it is easy to measure
the hange in position between the two di erent states by using the middle mouse button to pi k
the same atom in the two onformations.
On e that is done, it is easy to point out one interesting aspe t of the way VMD handles the
graphi s. Go to the Mol form, sele t one of the two mole ules, and press Toggle Fixed. Enter
translation mode and move the other mole ule around. Noti e that the number whi h lists the
distan e between the two atoms never hanges. That's be ause the mouse only a e ts the way the
oordinates are translated to the s reen image. It does not a e t the real oordinates at all. It is
possible to hange the oordinates in a mole ule using the text ommand interfa e, or by using the
atom move pi k modes [x3.1.1℄).
By the way, un x the mole ules and do a `Reset View' from the right pull-down menu to reset
everything. Load up the third stru ture, deoxy.pdb and give it the same sele tion as the other two
mole ules. However, olor this one green. Pull out Nature v. 371, O t. 27, 1994 and turn to page
740. With a bit of manipulation you should be able to re reate the image that appears there.

18
Chapter 3

User Interfa e Components


There are several methods available in VMD for the user to ontrol and intera t with the mole ular
display. The primary methods are by using the mouse, either in the VMD graphi al display window
(where the mole ule is displayed) or in the di erent graphi al user interfa e (GUI) forms provided
by the program. There is also a third user interfa e omponent, the text onsole interfa e, in whi h
the user an enter and exe ute simple ommands or more sophisti ated VMD s ripts. Also under
development, but not do umented here due to their experimental nature, are user interfa e om-
ponents based on three-dimensional input devi es and on spee h- and gesture-re ognition systems.
This hapter des ribes how to use the mouse-based user interfa e omponents; it des ribes the basi
operation of the graphi al user interfa e omponents, and gives a qui k overview of ea h available
form. In VMD, the GUI is omposed of several distin t windows, alled forms, whi h provide a set
of buttons, sliders, hoosers, et . to ontrol some spe i element of the program.
The other primary user interfa e omponent, the text user interfa e, is des ribed fully in hapter
x 10.

3.1 Using the Mouse in the Graphi s Window


The graphi s display window is labeled OpenGL Display and ontains a display of the various
mole ules and other graphi al obje ts, like the axes, whi h make up the s ene. When the mouse
ursor is lo ated inside the graphi s display window, it may be used to perform the following
a tions:
 Rotate, translate, or s ale the displayed mole ules
 `Pi k' atoms or other obje ts. That is, sele t them in order to move them around, label them
et .
 Exe ute ommands from the popup menu, available by pressing the right mouse button
 Move the lights
 Translate and rotate a set of atoms
 Apply a for e (a eleration) to a set of atoms
There are also hot keys, or keyboard a elerators, available when the mouse is in the graphi s display
window. These hot keys are bound to some VMD text ommands, whi h are exe uted when a hot

19
key is pressed. VMD has several built-in hot key ommands (see Tables 3.1, 3.2, 3.3 and 3.4), and
the user an add new ones as well (overriding the built-in ones if desired). A des ription of how to
set up personal hot key ommands is given in se tion x 14.1.

3.1.1 The Popup Menu


Pressing the right mouse button while the mouse ursor is in the graphi s display window a tivates
the VMD popup menu. This menu ontains a number of ommands, and also submenus with
ommands, whi h may be exe uted by sele ting the option while keeping the third mouse button
pressed and then releasing the button. The ommands a essed via the popup menu simply exe ute
a text ommand whi h is bound to the sele ted popup option, just as if that ommand had been
entered at the VMD ommand prompt. There are options available in VMD to add your own
submenus and ommands to the main VMD popup menu, to ustomize this GUI ontrol to your
personal taste. See se tion x 14.1 for a omplete des ription of how to do this, and how to make
these popup menu ustomizations available every time you start up VMD.
In addition to this general popup menu, there is also an atom/mole ule spe i popup menu
whi h is available when one holds down both the shift key and the rightmost mouse button over
any atom in a mole ule. This submenu ontains options to hange how the mole ule is rendered,
to display information about the mole ule, and to perform a tions su h as x the mole ule in pla e
or hide it from view. The following se tion des ribe the menu options for both the general and
atom-spe i popup menus.
The following se tions des ribe the submenus and options available in the general VMD popup
menu.

Mouse Mode Submenu


The mouse, while positioned within the graphi s display window, is used to perform a variety of
fun tions. There are several di erent modes whi h the mouse may be in at any time; the urrent
mouse mode determines what the e e t is when the user presses the left or middle button. Ea h
mouse mode, ex ept the lights mode (see below), auses the ursor to a quire a hara teristi shape.
The mouse mode is hanged via the popup menu; pressing the right mouse button brings up this
menu, whi h ontains several submenus with various ommands. The rst two submenus, `Mouse
Mode' and `Pi king Mode', are used to set the mouse mode. Note: the a tions performed from the
'Mouse Mode' submenu do not hange the atom oordinates, while the a tions performed from the
'Pi king Mode' do. The available modes are as follows:
 Mouse Mode ! Rotation Mode
When the mouse is in this mode, holding the left mouse button down and moving the mouse
rotates the mole ules about axes parallel to the s reen, in a `virtual tra kball' behavior. To
get a rotation around the axes oming out of the s reen (the `z' axis), hold the middle button
down and move the mouse left ( lo kwise) or right ( ounter- lo kwise).
You an keep the mole ules rotating without ontinuously moving the mouse. Start the
mole ule moving with the mouse, as above, then release the mouse button before you stop
moving the mouse. With some pra ti e it be omes easy to impart a slight spin on the mole ule,
or whirl it about madly. To stop the rotation, either press and hold the left mouse button
down until the mole ule stops moving, or use the pop-up menu and sele t `Stop Rotation.'

20
The hot key to enter rotation mode is r. Also, pressing r or any of the other mouse mode
hot keys auses the rotation to stop.
 Mouse Mode ! Translation Mode
When the mouse is in translation mode, holding the left button down allows you to move
the mole ules parallel to the s reen plane, so, for example, moving the mouse left moves the
system left. To move the mole ule towards or away from you, hold the middle button down
and move the mouse right or left, respe tively.
The translation hot key is t; pressing t while the mouse is in the graphi s display window
will hange the mouse to translation mode.
 Mouse Mode ! S aling Mode
The s aling mode has the simplest mouse ontrols as pressing either the left or middle button
down and moving to the right enlarges the mole ules, and moving the mouse left shrinks them.
The di eren e is that the middle button s ales faster than the left button.
The s aling hot key is s.
 Mouse Mode ! Move Lights Mode
VMD provides up to four separate light sour es to illuminate the graphi s obje ts in the
display window. These light sour es a t independently, and use the native lighting hardware
a eleration available on the graphi s workstation (if any). Thus, they do not ast shadows,
and their e e t is not al ulated with any form of raytra ing or similar algorithm. They do,
however, add a ni e realisti e e t to the obje ts and help give the appearan e of material
hara teristi s to spheres, ylinders, and so forth. You an use the mouse to rotate ea h
of the light sour es in spa e to a new position; you an even set a spe i light to rotate
ontinuously about the origin.
The light sour es are lo ated at in nity, so only their orientation is important. To enter the
move light mode in order to position a spe i light, sele t the `Move Light' submenu from
the `Mouse Mode' menu, and sele t a light. Not all lights are turned on; those that are on
are indi ated with a he k mark. On e a light is hosen, the mouse is set to rotate that light
sour e; a line should appear from the origin towards the hosen light. The ontrols for this
mode are the same as the rotation mode ontrols, so holding the left button down allows
you to rotate the light around an axis parallel to the s reen, while holding the middle button
allows for rotations perpendi ular to the s reen. To stop moving the light sour e, hange the
mouse to another mode via the popup menu or by pressing a hot key.
If the light is not urrently on, moving that light sour e will not a e t any hange in the
displayed image. To turn a light on or o , use the Lights browser in the upper right of the
Display form [x3.3.8℄.

Pi k Item Mode Submenu


The mouse an also be used to sele t things from the s reen. As with many mole ular graphi s
programs, an atom an be pi ked by moving the ursor over it and li king the left mouse button.
When an atom is pi ked for the rst time, a text label appears whi h shows the atom residue name
and number, and the atom name. Cli king on the atom again turns the label o .
Pi king atoms with the mouse is used to turn on or o various types of labels, to query for
information about an obje t, or to move items around on the s reen. You an label an atom (and

21
display the atom name), or you an label geometri values su h as the distan e between two atoms
(a bond label), an angle between three atoms (an angle label), or the dihedral angle formed by four
atoms (a dihedral label). This is done by setting the mouse into the proper pi king mode and then
sele ting the relevant atoms with the mouse.
You rst sele t the proper pi king mode by using the popup menu, and hoosing the mode
required to perform the desired a tion. The available a tions when in pi k item mode are:
 Pi k Item Mode ! Query
Cli king with the left or middle mouse button on an item will print out the name of the item
(e.g. the atom name) to the text onsole window. The hot key to set this mode is `0'.
 Pi k Item Mode ! Center
This mode is used to hange the point about whi h a mole ule rotates when the mole ule
is rotated. To ause a mole ule to rotate about a spe i atom, sele t this mode and then
li k on that atom. The rotation point may be restored to its default position (the enter
of volume of the mole ule) by exe uting the `Reset View' option from the popup menu (see
below). The hot key to set the mouse to Pi k Item Mode ! Centering mode is ` '.
 Pi k Item Mode ! Atom
Cli king on an atom will toggle on/o a label for the atom. The hot key to set this mode is
`1'.
 Pi k Item Mode ! Bond
Cli king on two atoms in a row will toggle on/o a bond distan e label between the two atoms
(a dotted line with the distan e printed at the midpoint). The hot key to set this mode is `2'.
 Pi k Item Mode ! Angle
Cli king on three atoms in a row will toggle on/o a label showing the angle formed by the
three atoms. The hot key to set this mode is `3'.
 Pi k Item Mode ! Dihedral
Cli king on four atoms in a row toggles on/o a label showing the dihedral angle formed by
the four atoms. The hot key to set this mode is `4'.
 Pi k Item Mode ! MoveAtom
In this mode, the position of an atom an be hanged by li king on the desired atom,
and dragging with the mouse while the button is still pressed. This will hange the atom
oordinates. The hot key to set this mode is `5'.
 Pi k Item Mode ! MoveResidue
This mode may be used to move all the atoms in a sele ted residue at the same time. Sele t
an atom in a residue, and move it to a new position while keeping the mouse button pressed.
All the atoms in the same residue as the sele ted one will be moved the same amount. Holding
down the <shift> key and the left mouse button while moving the mouse will rotate the atoms
in the residue about the sele ted atom. If the middle mouse button is held down instead, the
atoms in the residue will rotate about a line drawn through the pi ked atom and parallel to
a line oming dire tly out of the s reen. This behavior is similar to the usual Rotate mode,
ex ept that oordinates of atoms are hanged.
The hot key to set this mode is `6'.

22
 Pi k Item Mode ! MoveFragment
A fragment is a set of atoms all onne ted by a series of ovalent bonds. This mode a ts just
like MoveResidue, ex ept that the atoms whi h are moved are all in the sele ted fragment
rather than in the sele ted residue. This will hange the atom oordinates. Holding down
the <shift> key and the left mouse button while moving the mouse will rotate the atoms in
the fragment about the sele ted atom. If the middle mouse button is held down instead, the
atoms in the fragment will rotate about a line drawn through the pi ked atom and parallel to
a line oming dire tly out of the s reen. This behavior is similar to the usual Rotate mode,
ex ept that oordinates of atoms are hanged.
The hot key to set this mode is `7'.
 Pi k Item Mode ! MoveMole ule
This mode may be used to move all the atoms in a sele ted mole ule at the same time.
Sele t an atom in a mole ule, and move it to a new position while keeping the mouse button
pressed. All the atoms in the same mole ule as the sele ted one will be moved the same
amount. Holding down the <shift> key and the left mouse button while moving the mouse
will rotate the atoms in the mole ule about the sele ted atom. If the middle mouse button
is held down instead, the atoms in the fragment will rotate about a line drawn through the
pi ked atom and parallel to a line oming dire tly out of the s reen. This behavior is similar
to the usual Rotate mode, ex ept that oordinates of atoms are hanged.
The hot key to set this mode is `8'.
When a label is added to a mole ule (say, for a bond, or just to show the name of an atom), a
new entry will be added to the list of urrent labels whi h is available via the Labels form [x 3.3.7℄,
or from the Labels popup menu ommands. These ontrols also ontain options to turn the labels
on or o , or to delete them entirely from memory.
Sin e atom and bond pi king is a very ommon a tion, these two types of labels an be added
without having to set the mouse to a pi king mode. To just add an atom label, li k on and release
the left mouse button while pointing to an atom, without moving the mouse during the li k and
release. To add a bond label, li k on and release the middle mouse button on rst one, and then
the other, of the two atoms involved. Again, make sure not to move the mouse while the button is
pressed down.

Display Modes Submenu


From the popup menu you an ontrol ertain settings for the graphi s display window. This
submenu is used to ontrol what stereo mode is available, and how the 3D graphi s are proje ted
onto the 2D s reen. The ommands available in this menu are:
 Display Modes ! Perspe tive
In perspe tive mode, items loser to the viewer appear larger than items further away from
the viewer. This is the default proje tion in VMD. Sele ting this option sets the display for
perspe tive proje tion.
 Display Modes ! Orthographi
In orthographi mode, graphi al obje ts are merely proje ted straight onto the s reen, with
no onsideration of their distan e from the viewer. Sele ting this option sets the display to
use orthographi proje tion.

23
 Display Modes ! Stereo O
This ommand sets the display window ba k to a non-stereo mode, if it was in another mode
displaying stereo images.
 Display Modes ! CrystalEyes
Sele ting this mode tells VMD to display the graphi s in stereo, using Stereographi s Corp.
Crystal Eyes stereo equipment (if available). In this mode, the monitor is set to a spe ial
s anning state to display overlapping left and right eye images, and the user must wear spe ial
glasses to see the stereo image. This is des ribed in depth in se tion x9.
 Display Modes ! CrossEyes

 Display Modes ! SideBySide


In these stereo modes, the graphi s display window is split into two side-by-side halves, and
separate right and left eye images are shown in the two halves. In SideBySide mode, the left
eye image is shown on the left side, and the right eye image is shown on the right side. In
CrossEyes mode, the images are reversed.
 Display Modes ! Left

 Display Modes ! Right


These stereo display modes a tually only show a single image; the image shown, however, is
that whi h would be shown for the left or right eye, respe tively, if any of the other stereo
display modes were sele ted.

Fit Submenu
When one has two similar stru tures, one often wants to ompare them. What's the di eren e
between two X-ray stru tures? How mu h did the stru ture hange during a simulation? To
answer these questions, you must rst gure out how to ompare two stru tures, whi h usually
means that you must nd the root mean square deviation (RMSD).
Formally, given N atom positions from stru ture x and the orresponding N atoms from stru -
ture y with a weighting fa tor w (i), the RMSD is de ned as:
 PN  12
wi kxi yi k
i=1P
2
(N ; x; y ) =
N N
RM S D
i=1 wi
Using this equation by itself probably won't give you the answer you are looking for. Imagine
two identi al stru tures o set by some distan e. The RMSD should be 0, but the o set prevents
that from happening. What you really want is the minimum RMSD between two given stru tures;
the best t. There are many ways to do this, but for VMD we have implemented the method of
Kabs h (A ta Cryst. (1978) A34, 827-828 or see le Measure.C in the VMD sour e ode). This
algorithm omputes the transformation, needed to move one stru ture onto another in order to
minimize the RMSD.
With the mathemati al prerequisites behind us, we still need to be able to spe ify how to hoose
the atoms to ompare. If you want to ompare all the atoms in both stru tures, and they both
have the same number of atoms, then the problem is easy { N is everything. This o urs most
often in MD simulations when the only thing di erent between two stru tures are the oordinates.

24
But what about homologous sequen es? In this ase, the number of atoms di er be ause
while the number of residues is the same, the side hains have di erent numbers of atoms. The
usual solution is to determine the RMSD based solely on the ba kbone atoms or, in some X-ray
stru tures where only the C atoms have been determined, based on the C atoms. In addition,
VMD allows two other methods for tting. Fitting by heavy atoms omits the hydrogens, sin e their
positions are often not well determined. Fitting by \pi ked atoms" performs only a translation to
bring one atom dire tly on top of another mole ule.
Hopefully the previous dis ussion revealed the importan e of the options available in the t
submenu. Before examining ea h of them in turn, you should be aware of some VMD de nitions.
In VMD, a \mole ule" refers to all the atoms from a stru ture le. The le may ontain multiple
mole ules under standard hemi al usage, but VMD still thinks of them as one mole ule. Instead,
those individual parts are alled \fragments," for la k of a better term. With this said, the t
options in the submenu in lude:
 Fit ! Do RMSD Fit
The tting will hange the stored oordinates of one of the molu ules.
 Fit ! Print RMSD
VMD wll print out the RMSD between the mole ules after tting them together, without
hanging their stored oordinates.
 Fit ! Two Mole ules

 Fit ! Two Fragments


These two submenus ontain the same options, whi h sele t whi h atoms of the two mole ules
should be used to do the least squares t. For the rst submenu, the atoms used will be taken
from all the atoms in two di erent mole ules; for the se ond submenu, the atoms used will
only be taken from two separate fragments, where a fragment is a onne ted hain of residues.
The available atom sele tions for tting the mole ules are:
{ All atoms;
{ Heavy atoms (i.e., all ex ept hydrogen);
{ Ba kbone atoms;
{ CA (that is, C ) atoms;
{ Pi ked atoms (i.e., atoms urrently labeled on the s reen).
Presently the VMD feedba k for RMSD pi ks is a little terse. To make things lear, here is
the pro ess: First sele t one of the options (i.e., All atoms; Heavy atoms; et .) from the t
submenu. VMD will respond with a on rmation of your hoi e and then it will ask you to
li k on one atom of ea h of the two sele tions you would like to ompare. The sele tion you
li k on rst will be moved to the sele tion you li k on se ond. The atoms that you li k on
are representative of the entire mole ule, fragment, set of heavy atoms, et . asso iated with
those atoms. Thus, if you have hosen to RMSD t two mole ules, then li king on one atom
for ea h of the two mole ules does in fa t spe ify an RMSD al ulation involving all atoms of
the two mole ules.
As a simple example of omputing RMSD, load the same mole ule twi e. Press the `8' key
(this puts VMD into the \MoveMole ule" pi k mode and lets you use the mouse to hange

25
the oordinates of a mole ule). Cli k and drag one of the mole ules away from the other so
there is a spa e between the two.
By default the t routines are on gured to do the best t but for this example you will only
ompute the RMSD, so pi k \Fit ! Print RMSD." Now go to the pop-up menu and pi k
\Fit ! Two Mole ules ! All Atoms." Look at the VMD onsole window and you'll see a
new line was printed to show the urrent state. The mouse should look like a rosshair. Pi k
one of the atoms in the rst mole ule and then one of the atoms in the se ond mole ule. The
value of the RMSD will be printed to the s reen, for example:

RMSD between the two mole ules is: 1.123410

In ase of two identi al mole ules the RMSD al ulation should, of ourse, give zero as a
result. To stop omputing RMSDs, simply hange the mouse mode to what you want to do
next, for example, press r to go to the rotate mode.
A dis ussion of advan ed RMSD features available through the s ripting interfa e an be
found in se tion x16.7.
VMD's atom alignment should be able to handle most ommon tasks, but there are some it
annot do. If this o urs, you might want to look at Andrew Martin's ProFit at
http://www.bio hem.u l.a .uk/~martin/text/ProFit.readme

Labels Submenu
The labels submenu is used to ontrol the appearan e of text labels whi h may be pla ed on atoms,
and of bond, angle, and dihedral angle labels whi h may be reated between atoms. On e a label
is pla ed on an atom or set of atoms, through the use of the mouse (see se tion x 3.1.1), it may
be turned on or o , or deleted entirely, through use of this submenu and also through use of the
Labels form [x 3.3.7℄ form as explained later in this manual. The labels submenu has the following
options:
 Labels ! Show
If a label has been previously added to, e.g., an atom, but has been hidden from view, this
submenu ontains options to turn the label ba k on. It ontains submenus for the following
ategories of labels:
{ Labels ! Show ! Atoms
{ Labels ! Show ! Bonds
{ Labels ! Show ! Angles
{ Labels ! Show ! Dihedrals
Ea h submenu ontains a list of the labels whi h have been added to that menu; sele ting the
label from the submenu turns on that label.
 Labels ! Hide
This a ts identi ally to the Labels ! Show menu, ex ept that it is used to hide labels from
view instead of to display them. It ontains the same submenus of label ategories.

26
 Labels ! Delete
This a ts identi ally to the Labels ! Show menu, ex ept that is is used to delete labels
entirely. It ontains the same submenus of label ategories.
 Labels ! Delete all
This ommand will delete all the labels urrently stored in ea h label ategory.

Animate S ene Submenu


A mole ule in VMD an ontain any number of oordinate sets; the resulting mole ular traje tory
may be played ba k in order to animate the mole ule. This submenu ontains ommands to ontrol
the animation, mu h like the ontrols for a VCR or tape player. The animation an also be
ontrolled via the Animate form [x 3.3.5℄. The ommands available in this submenu are:
 Animate S ene ! play forward
Causes the animation to start playing forward through the frames whi h have been read into
memory.
 Animate S ene ! play reverse
Plays the animation in reverse.
 Animate S ene ! step 1 forward
Advan es the animation one frame forward, and then pauses it. If the end is rea hed, the
animation goes ba k to the initial frame.
 Animate S ene ! step 1 reverse
Advan es the animation one frame ba kwards, and then pauses it. If the start of the animation
is rea hed, the last frame is displayed.
 Animate S ene ! pause
Pauses the display at the urrent frame.
 Animate S ene ! goto start
Rewinds the animation to the initial frame, and pauses the animation.
 Animate S ene ! goto end
Fast-Forwards the animation to the nal frame, and pauses the animation.
 Animate S ene ! Style
This submenu ontrols how the animation behaves when it rea hes the beginning or end of
the traje tory. The following styles may be sele ted:
{ Animate S ene ! Style ! On e
When the end of the traje tory is rea hed (or the beginning, if the mole ule is being
animated in reverse), the animation will be paused at the last ( rst) frame.
{ Animate S ene ! Style ! Loop
Causes the animation to loop around ba k to the start of a traje tory when the end is
rea hed, or vi e versa if playing in reverse.
{ Animate S ene ! Style ! Ro k
Causes the dire tion in whi h the animation is playing to reverse when the end or start
of the traje tory is rea hed.

27
Spin/Ro k S ene Submenu
These ommands allow you to spin or ro k the displayed mole ules. A spin is a onstant rotation
in a given dire tion, and a ro k is rotation that alternates between one dire tion and its opposite.
Thus, `Spin X' rotates the system in a onstant speed around the X axis and `Ro k Z' ro ks it
around the Z axis. The speed of rotation and total ro k angle are urrently xed. Available
ommands are:
 Spin/Ro k S ene ! Stop Rotation
Halts the rotational motion of the displayed mole ules, i.e. sets their spin and ro k values to
be zero.
 Spin/Ro k S ene ! Spin (X, Y or Z)
Imparts a onstant angular velo ity (spin) to the mole ules around the sele ted axis.
 Spin/Ro k S ene ! Ro k (X, Y or Z)
Imparts a onstant angular velo ity (spin) to the mole ules around the sele ted axis. After
the mole ule rotates through a 180Æ ar , the rotation dire tion is reversed.

Stop Rotation
Halts the rotational motion of the displayed mole ules, i.e. sets their spin and ro k values to be
zero.

Reset View
VMD does not a tually alter a mole ule when it is translated or s aled. Instead, it hanges the
transformation matrix used to onvert the atomi oordinates to s reen oordinates. The initial
de nition of this matrix is set up so that the top mole ule [x 3.3.2℄ takes up most of the s reen.
However, after moving things about, you may want to reset the view to bring the mole ule ba k to
the initial position. Sele ting `Reset View' allows you to do just that.

Show Form Submenu


The GUI ontrols for VMD, also known as forms, onsist of separate windows ontaining ontrols
for the program. The forms may be individually displayed on the s reen or hidden from view. This
menu provides one way to display a form. To do so, sele t the name of the form to display from
the `Show Form' submenu. If the box to the left is he ked, it is already turned on and sele ting it
again will not a e t anything. To bring the form to the front of s reen, you will have to turn the
form o then ba k on.

Hide Form Submenu


This menu provides another way to lose a form. Sele t the form name to turn it o .

Help
Starts an HTML viewer (like Mosai or Nets ape) and displays on-line VMD help do uments. The
viewer is designated by the environment variable VMDHTMLVIEWER [x 17.2℄. Starting help multiple
times will start multiple viewers. The default web browser is Nets ape. The following do uments
an be a essed from this submenu:

28
 Qui k Help - A listing of ommon pro edures in VMD
 User's Guide - An online version of what you are presently reading
 VMD Home Page - The WWW site from whi h you an a ess many VMD do s
 VMD FAQ - A listing of fequently asked VMD questions (plus answers)
 Mailing List - Allows you to a ess an ar hive of past VMD dis ussions
 T l - If you need hints on programming the s ripting interfa e
 Software - Links to ommon programs used by VMD (i.e. renderers)
Note, you may need to have Nets ape or Mosai up and running before su essfully sele ting
these options. That is, if you obtain a message su h as ``nets ape: not running on display
:0.0'', then you will have to start up the program yourself, after whi h VMD will be able to dire t
you to the orre t page.

Quit Submenu
Opens a submenu asking if you really want to quit.

Play File
For es VMD to exe ute the T l ommands found in a le of your hoosing.

Save Con g
With this option, VMD saves information about the representations and viewing angle hara ter-
izing your display of the s ene. It reates a log le of T l ommands whi h an be read ba k in at
a later time to reprodu e the images seen in the output window. See also se tion x 16.3 for text
interfa e that an be used to save/restore VMD state information.

3.1.2 Atom/Mole ule Spe i Popup Menu


In addition to the general popup menu whi h is always available with a right mouse button li k,
there is also an atom-spe i menu whi h appears when you hold down both the Shift key and
the right mouse button while positioned over an atom in the display. The options available in this
menu allow one to qui kly ustomize sele tions and representations.

Center
Designates the position of the atom being li ked on to be the new enter of transformations su h
as rotation, s aling, and translation.

Pi k
Performs a sele tion of the atom being li ked on. This will toggle labels on and o

29
Info
The Info menu gives you a synopsis of properties for the atom that you are holding the mouse over.
In parti ular, information about the following elds is identi ed:
 Name - the name of the atom as it appeared in the oordinate le
 Type - the type of the atom, as determined by an internal VMD mat h-up of the given name
to a likely atom type asso iated with that name
 Index - the internal VMD index used to identify the atom; this is useful for spe ifying sele tion
syntax to generate di erent representation styles for parti ular atoms. For PDB les Index
orresponds to the atom number listed in the le minus 1 (so that the index starts with 0).
 Resname - the type of the amino or nu lei a id to whi h this atom belongs
 ResId - the internal VMD ID number of the entire residue to whi h the parti ular atom
belongs. E.g., ResId for an atom of a protein is the same as the residue number of that atom
as listed in its PDB le.
 Chain - if the oordinate le ontained data in the \Chain" eld for this atom, then that data
is given here.
 Segname - the name of the segment to whi h this atom belongs
 X, Y, Z - the position of the atom in 3D spa e
In addition, there is an option \Print" in the Info submenu whi h simply prints the information
into the onsole window, in ase you would like to ut and paste the data somewhere else.

Mol Status
As dis ussed in se tion x3.3.2, there are a number of attributes whi h hara terize the display of a
given mole ule on the s reen. A few of the most important properties whi h an be toggled on and
o with the MolStatus menu in lude:
 Top - makes the mole ule to whi h the pi ked atom belongs to the top one (a he k mark
indi ates its status)
 Make A tive/Make Ina tive - several VMD ommands operate on multiple a tive mole ules.
Toggling this parameter will allow you to ontrol whether or not these a tions are done to
your mole ule of interest.
 Fix/Free - Fixed mole ules do not undergo rotation, translation, or s aling. Free mole ules
do.
 Hide - Refrain from displaying the sele ted mole ule

30
Atom Sele tion
This submenu allows you to sele tively display portions of a mole ule based on relationships to the
pi ked atom. Presently this is the only way to de ne atom sele tions in a graphi al fashion. All
other sele tions must be des ribed via a text-based entry form. The following riteria may be used.
In ea h ase, VMD will render only those atoms whi h have the following property in ommon with
the sele ted atom
 Same Residue
 Same Chain
 Same Segname
 Same Fragment
In addition, the urrently sele ted atom an be used as a representative of the entire mole ule by
hoosing to render only the following atoms of the mole ule.
 ba kbone - VMD should display ba kbone atoms only
 protein - only atoms omprising a protein should be displayed
 nu lei - only display atoms omprising nu lei a ids
 water - only display water atoms in the mole ule
 not waters - only display non-water atoms in the mole ule
 heavy atoms- only display the heavy atoms of the mole ule
Note that this submenu only a e ts the rst representation (view) listed in the Graphi s form
[x3.3.4℄ for the given mole ule.

Rendering Method
With this submenu, you an again use the urrently pi ked atom as a representative of the entire
sele tion it belongs to. You an swit h the representation style to any of those listed in se tion x5.
This will a e t only the rst representation ontaining the pi ked atom in the list of representations
a essible through Graphi s form.

Coloring Method
Mu h in the spirit of the Rendering Method submenu, with this option you an hange the way
in whi h the rendered sele tion asso iated with the pi ked atom is olored. Any of the options
des ribed in the se tion on oloring methods [x 6℄ are valid.

3.1.3 Delete Representation


As its name suggests, with this option of the atom spe i popup menu, you may delete the urrent
representation of whi h the atom pi k is a part of. The lowest-numbered representation ontaining
the pi ked atom will be deleted.

31
3.1.4 Hot Keys
When the mouse is in the graphi s window, several more ommands are a essible via programmable
hot keys. They allow you to do things like hange mouse modes or advan e the animation by a
frame by simply pressing a key. The default key bindings are listed in the following tables. The
ommands listed are the text ommands whi h are exe uted when the hot key is pressed; these text
ommands are explained in se tion x10.3. See se tion x14.1 for information on how to ustomize
the behavior of these hot keys and how to add new hot key ommands.
Hot Key Command Purpose
r, R mouse mode 0 0 enter rotate mode; stop rotation
t, T mouse mode 1 0 enter translate mode
s, S mouse mode 2 0 enter s aling mode
0 mouse mode 4 0 query item
mouse mode 4 1 pi k enter
1 mouse mode 4 2 pi k atom
2 mouse mode 4 3 pi k bond (2 atoms)
3 mouse mode 4 4 pi k angle (3 atoms)
4 mouse mode 4 5 pi k dihedral (4 atoms)
5 mouse mode 4 6 move atom
6 mouse mode 4 7 move residue
7 mouse mode 4 8 move fragment
8 mouse mode 4 9 move mole ule
% mouse mode 4 10 for e on atom
^ mouse mode 4 11 for e on residue
& mouse mode 4 12 for e on fragment

Table 3.1: Mouse ontrol hot keys.

32
Hot Key Command Purpose
x ro k x by 1 -1 spin about x axis
X ro k x by 1 70 ro k about x axis
y ro k y by 1 -1 spin about y axis
Y ro k y by 1 70 ro k about y axis
z ro k z by 1 -1 spin about z axis
Z ro k z by 1 70 ro k about z axis
j, Cntl-n rotate x by 2 rotate 2Æ about x
k, Cntl-p rotate x by -2 rotate 2Æ about x
l, Cntl-f rotate y by 2 rotate 2Æ about y
h, Cntl-b rotate y by -2 rotate 2Æ about y
g rotate z by 2 rotate 2Æ about z
G rotate z by -2 rotate 2Æ about z
Cntl-a s ale by 1.1 enlarge 10 per ent
Cntl-z s ale by 0.9 shrink 10 per ent
Table 3.2: Rotation & s aling hot keys.

3.2 Using the Forms library


The various menus used in VMD are based on the XForms Library developed by Mark Overmars
and T. C. Zhao. In this library, ea h graphi al user interfa e omponent window is referred to as
a form. A form ontains a olle tion of graphi al ontrols, su h as buttons, sliders, browsers, et ,
des ribed in the following se tions.

3.2.1 Buttons

Figure 3.1: Simple buttons

Figure 3.1 shows some of the buttons used by VMD. For example, the button in 3.1 A draws all
the loaded les and the one in 3.1 C writes the urrent s reen des ription for use in a ray-tra ing
program. Some buttons, as in 3.1 B, indi ate if something is turned on or o by turning an indi ator
light on or o . They an be turned on or o by li king on the button. Others, shown in 3.1 D,
indi ate that they are pressed by appearing re essed.
One ommon button usage motif in VMD is shown in gure 3.2. These indi ate that the value
in the middle an be in reased by pressing the button(s) on the right and de reased by pressing
the button(s) on the left. If there are two sets of buttons, as in 3.2 B, then the outer set of buttons
hange the number in larger in rements than the inner set.

33
Hot Key Command Purpose
Alt-M menu main off;menu main on Show main menu
Alt-m menu mol off;menu mol on Show mol menu
Alt-f menu files off;menu files on Show les menu
Alt-a menu animate off;menu animate on Show animate menu
Alt-e menu edit off;menu edit on Show edit menu
Alt-g menu graphi s off;menu graphi s on Show graphi s menu
Alt-l menu labels off;menu labels on Show labels menu
Alt-r menu render off;menu render on Show render menu
Alt-d menu display off;menu display on Show display menu
Alt- menu olor off;menu olor on Show olor menu
Alt-s menu sim off;menu sim on Show sim menu
Alt-t menu tra ker off;menu tra ker on Show tra ker menu
Cntl-r display resetview Reset display
Alt-q quit onfirm Quit VMD with on rmation
Alt-Q quit Quit VMD
Alt-h hyperref invert Invert hyper text mode (NOT help)
Table 3.3: Menu ontrol hot keys.
Hot Key Command Purpose
+,f,F animate next move to next frame
-,b,B animate prev move to previous frame
.,> animate forward play animation forward
, animate reverse play animation reverse
< animate reverse play animation reverse
/, ? animate pause stop animation
Table 3.4: Animation hot keys.

3.2.2 Sliders
Sliders are used somewhat rarely in VMD, typi ally to ontrol some smoothly varying quantity
that should always be set within some de nite limits. An example from ea h is shown in gure 3.3.
To use a slider, li k and drag on the interior re tangle.

3.2.3 Choosers
Choosers look like the items in gure 3.4. They are used to sele t one of a list of possible hoi es.
There are two ways to hange the sele tion. Cli king with the left mouse button brings up the
list of hoi es. Move the mouse to the orre t sele tion and release the button to pi k that item,
or release the button outside of the menu to keep the original sele tion. Cli king with the right
mouse button advan es the sele tion through the list by one. If the urrently sele ted item is the
last element of the list, the sele tion loops around to the rst item.

34
Figure 3.2: A ommon button motif

Figure 3.3: Sliders

3.2.4 Text Entry Areas


Figure 3.5 shows an example text entry. These are used for things su h as atom sele tion or for
entering lenames. To sele t a text entry, use the mouse and li k on the appropriate eld, or
press the tab key to move between di erent text entry areas. The urrently a tive area should have
a brighter ba kground. Some ema s-style ontrol keys are allowed, so ^A ( ontrol-A) goes to the
beginning of the line, ^E goes to the end, ^B moves the ursor ba k by one without deletion, and
^F moves it forward one. ^H or ba kspa e deletes the previous hara ter, and ^K deletes everything
from the ursor to the end of the line. The mouse an be used to sele t text inside the entry eld.
If text is sele ted, pressing any normal key repla es the text, and pressing ba kspa e deletes it.
Cut-and-paste operations among XForms text entry regions and other X-Windows appli ations are
allowed.

Figure 3.4: Choosers

35
Figure 3.5: A Text Entry Area

3.2.5 Browsers

Figure 3.6: Several Browsers

Another way to view a list of items is to use a browser, as shown in gure 3.6. A browser displays
several items on the s reen (unlike the hooser whi h only shows one) and has a slider whi h is used
to s roll though all the available options. Sele ted items are highlighted. Some browsers only allow
one item to be sele ted, while others allow multiple sele tions and do not automati ally desele t a
line when a new item is pi ked. To turn o a sele ted item when multiple sele tions are allowed,
li k on the item, and the highlight will disappear.
One ommon browser motif uses oupled browsers to des ribe two-level hierar hies. Sele ting
a line in the rst browser determines the possible sele tions in the se ond. An example is shown in
gure 3.6 B.

3.2.6 File Browser


This form, as shown in gure 3.7, is used for input or output le sele tion. The urrent dire tory
is shown on the line labeled Dire tory, and is hanged by li king on the urrent dire tory name
and entering the new name into the text entry eld whi h appears. On the left side of the form
is a browser whi h alphabeti ally lists all of the available dire tories and the les whi h mat h the
Pattern given on the se ond line. Note that the le sele tion pattern will use glob-style pattern
mat hing, not regular expression mat hing.
The browser an be used to traverse the le stru ture. Cli king on e on a dire tory name
hanges the urrent dire tory to the new one. If you li k on e on a le name, the name appears
in the le name text entry eld and an be modi ed as needed. To sele t the le name given in
the eld, press the enter key or li k on the Ready button, or else double- lo k the le name entry.
To an el this le sele tion, li k on the Can el button. To refresh the list of les in the dire tory
press Res an.

36
Figure 3.7: The File Browser

3.3 Des ription of ea h VMD form


VMD uses several di erent GUI forms, ea h designed to ontrol a spe i aspe t of the mole ular
display (e.g., to ontrol the appearan e of the graphi s display window, or to hange the olors of
displayed obje ts). Ea h form has a unique name, in ludes a button with the name of the form
near the top of the window. Pressing this button will hide the form from view. The following
se tions give a brief des ription of the forms available in VMD; the remaining hapters in this
manual des ribe the a tions whi h these forms make available in greater detail.

3.3.1 Main Form


The Main form, also alled the button bar, an turn most of the other forms on or o . It an also
be used to start an HTML viewer to see the VMD qui k help le, and to exit the program. The
buttons with lights ontrol whi h forms are turned on or o ; if the light is on, the form is being
displayed. Sometimes a form is turned on but is hidden behind other forms or windows. A qui k
way to bring the form to the top is to turn it o and then on again, as implemented for you using
the Menu short ut keys des ribed in Table 3.3.
The button bar an be losed by li king on the Main button and, as with all other forms, by
li king on the button in the enter top. There are several ways to re-open the form. The simplest
is to go to the window labeled OpenGL Display and use the pop-up menu that appears when you
press the right mouse button (see se tion x3.1 to sele t `Show Form' followed by `main'. It an also
be turned on with the text ommand menu main on.
The Help button starts up an HTML viewer (su h as Mosai or Nets ape) to view the Qui k
Help le (see General Help, x3.1.1).

37
Press the Quit button to exit VMD. This will bring up another form whi h veri es that you do
indeed wish to exit. Press Yes to quit, or No to return to VMD.

3.3.2 Mole ules (Mol) Form


The Mol, or Mole ules, form shows the global status of the loaded mole ules. Any number of
mole ules may be displayed by VMD simultaneously. Ea h mole ule an separately be hidden from
view, xed in pla e (e.g., prevented from being a e ted by mouse rotation ommands). This form
ontains ontrols to hange the status of the mole ules individually or in groups.

Loading a New Mole ule


The Load From Files button will a tivate the Files form [x3.3.3℄, whi h is used to read a new mole ular
stru ture in from a le or set of les. The Setup Remote Conne tion does nothing at this time; future
versions of VMD will use this button to a tivate a browser for running remote simulations. Chapter
x 4 des ribes fully how to load a mole ule and what le formats are supported.
The Mole ule List browser
The browser at the enter displays information about ea h mole ule. The Name is the le name
whi h ontained the topology information, followed by a unique integer ID whi h is assigned to
ea h mole ule by VMD when it is loaded. Atoms shows the number of atoms in the mole ule,
Frames gives the number of timesteps asso iated with the le, and Sour e is either File or Remote,
re e ting whether the information was a quired from a le or a remote simulation.
Next to ea h mole ule is a set of status ags, whi h indi ate the urrent Status of ea h mole ule.
Ea h mole ule has the following hara teristi s, whi h an be on or o :
 Top (T)
Top indi ates the default mole ule used in the text ommands when nothing is spe i ed for the
mol text ommand. It is also used in some forms (like Graphi s and Animate) to determine
ertain values. There an be only one top mole ule at a time.
 A tive (A)
Several ommands and a tions in VMD operate on many mole ules. These ommands, unless
spe i ally spe i ed otherwise, will do their a tion for all the a tive mole ules.
 Drawn (D)
If a mole ule is Drawn then it is being displayed in the graphi s display window. This is
useful for temporarily hiding a mole ule from view without deleting it.
 Fixed (F)
Fixed mole ules do not undergo rotation, translation, or s aling. Note that while it may seem
that one mole ule has been moved relative to another, the di eren e is only apparent. The
internal oordinates do not hange when a standard rotation is applied by using, for example,
the mouse. It is possible, however, to hange the oordinates of atoms in a mole ule, using
the text ommand interfa e, and by using the atom move pi king modes.

38
Changing the Mole ule's Status
The status of a given mole ule an be hanged by sele ting the mole ule in the browser and pressing
the toggle that ontrols the appropriate ag. The a tive, drawn, and xed status values an be
hanged for several mole ules at the same time by sele ting several mole ules before pressing the
toggle. However, only one mole ule an be top at any one time, so Make Top an only be applied
to one sele tion. Pressing one of the All ... or No ... buttons either sets or unsets orresponding
ag on all the loaded mole ules.
The Single A/D/T button makes the sele ted mole ule a tive, displayed, and top. It also resets
the s ene so the given mole ule roughly lls the s reen. It is a qui k way to swit h from viewing
one mole ule to another when it is desirable to only show one mole ule within the graphi s display
window at a time.

Deleting a Mole ule


The Delete button deletes all sele ted mole ules. There is no prompt verifying the deletion, so take
some are. If a deleted mole ule was the top mole ule, a new top mole ule will be set from the
remaining stru tures.

3.3.3 Files Form


The Files form is used to load a le from disk. It is not a essible via the button bar on the Main
form. Instead, use the Load From Files button in the Mole ules form or sele t the ` les` submenu
in the `Show Form' option available from the popup menu in the graphi s display.
To use this form, rst sele t the appropriate le type from the browser on the left (the available
le types are des ribed in se tion x4). One or two text input lines (depending on the mole ular
stru ture and oordinate le formats sele ted) will be displayed in the enter of the s reen. These
need to be lled with the appropriate le names, whi h an be done in two ways. The easiest is to
press the button to the left of the text area to bring up the le browser. The other way is to type
the name dire tly into the text area. To lear the le sele tion, press Reset; to an el the operation
press Can el.
On e you've sele ted the orre t le (or les), press the large button that says Load Mole ule.
The button will disappear and be repla ed with a message that says Loading . . . Please Wait. After
the les are ompletely pro essed, the stru tural information will be displayed in the text window,
and the Files form will be losed automati ally.

3.3.4 Graphi s Form


The Graphi s form is the most ompli ated form in VMD, whi h ould be expe ted from a visu-
alization program. The details of most of the subje ts dis ussed below are overed in the spe ial
topi s on sele tions [x 7℄, drawing methods [x 5℄, and oloring methods [x 6℄. In short, a mole ule
an have many di erent representation, also referred to as views. Ea h view onsists of three parts:
a sele tion, a drawing method (also alled representation style, and a oloring method. The sele -
tion determines whi h part of the mole ule is drawn, the drawing method de nes whi h rendering
representation is used, and the oloring method gives the the olor of ea h part of the representation.
There are a tually two parts to the graphi s form. The Image Controls button brings up the
ontrols used to alter the drawing and oloring methods. The Atom Name Lists button provides

39
a ess to browsers whi h display the lists of atom names, residue names, and so forth for the sele ted
mole ule.
This form is used to ontrol the appearan e of one mole ule at a time. The mole ule it a e ts is
sele ted in the `Sele ted Mole ule' hooser at the top of the form. The browser below this hooser
lists the views available for the mole ule. Ea h line of the browser shows information about the
drawing method, the oloring method, and the sele tion whi h ompletely spe ify the view. To
hange the attributes of a given view, li k on the view that should be hanged. The atom sele tion
for that view will appear in the Atom Sele tion text area and, if the Image Controls button is
pressed, the drawing and oloring method hoosers will also hange to re e t the urrent view.
To add a new view of the mole ule, enter the sele tion into the Atom Sele tion text area (or
keep what is there) and press Create New. This adds the view to the urrently sele ted mole ule.
To delete a view, sele t the view in the browser and press the Delete button. Bear in mind that
this does not delete the mole ule, it only deletes a view of the mole ule. (To delete the mole ule,
use the Mol form [x 3.3.2℄.)

Image Controls
The drawing method indi ates how the view's sele ted atoms are displayed in the graphi s display
window, and the oloring method indi ates how to olor the displayed atoms. The sele ted view's
drawing [x 5℄ and oloring [x 6℄ methods are hanged via the orresponding hooser. Some of the
methods have additional ontrols whi h will appear when that parti ular method (either drawing
or oloring) is hosen. The ontrols for the drawing method are:
 Line Width { only works on some versions of IRIX (see se tion x12.1).
 Sphere Res { detail level for rendered spheres
 Sphere Rad { sphere radius s aling fa tor
 Cylinder Res { ylinder resolution (number of sides in the polygon approximation)
 Cylinder Rad { ylinder radius s aling fa tor
For the oloring method, the transparent button allows you to make the drawing representation
semi-transparent (see x6.3). Also, when `ColorID' is hosen for the oloring method, a text entry
box is shown allowing you to spe ify the index of a olor to use for the sele tion, whi h may be a
number from 0 to 15.

Atom Name Lists


When the Atom Name Lists button is pressed, two browsers appear in pla e of the drawing and
oloring method ontrols. These are used to list the available keywords and values for use in
hoosing atoms for the sele ted views. The left browser ontains a list of the keywords and fun tions
understood by the sele tion ommand [x7℄. If a keyword is sele ted whi h an take on a value (for
instan e, name and index), then the possible names will be displayed in the rightmost browser. The
fun tions an be identi ed by the ( to the right of the name. After sele ting a keyword, the right
browser will display all the names asso iated with the keyword. For example, sele ting resname in
the left browser will show all the three-letter residue names known for the sele ted mole ule.
Cli king on a eld in the value browser will add it to the sele tion text eld. Double li king a
keyword eld adds the keyword to the text eld. A double li k is used so that the single li k is
available for simple viewing of the possible keyword values.

40
Changing Views
In addition to adding or removing views from a mole ule, this form is also used to hange how an
existing view is displayed. After sele ting a view for a spe i mole ule, the form's ontrols are
updated to show the urrent settings for that view. Changing the settings will automati ally hange
the respe tive view, and the new format will be shown in the graphi s display window. The display
will be updated after every hange, however, whi h is sometimes not always desirable (for example,
if a number of di erent aspe ts need to be hanged at on e). The Apply Changes Automati ally
button may be toggled o to hange this behavior { if it is turned o , sele ted hanges will only be
applied when the Apply Changes button is pressed. Sele ting a di erent view, or pressing the Clear
Changes button, before applying the hanges will reset the form ontrols to the urrent settings of
the sele ted view.
To lear the sele tion text for a given view double li k on the Clear Changes button. The rst
(and every odd) li k reverts the text to its previous setting, the se ond (and every even) li k
lears it ompletely.
A few details regarding the me hanism for `sele tions' is in order. For beginners, it is best
to use the Atom Name Lists and the Image Controls together in order to generate and organize
views. For instan e, load a mole ule and hoose the Atom Name Lists option. If you double li k
on the name keyword, you will noti e that two things happen. First, a listing of values appears to
the right of the keyword. Se ond, the word \name" appears in the text sele tion window. Now if
you go ahead and single li k on some of the available values, you will noti e that they are also
printed in the text sele tion box. In this way you an use the mouse to generate a des ription of
your sele tion and then hit Apply Changes in order to have that des ription register with VMD.
The moral is, if you want to reate a omplex des ription qui kly with the mouse:
 Use the Atom Name Lists to see what your available options are.
 Double li k on the keyword in order to enter it in the sele tion text box.
 Single li k on ea h of the desired values for the keyword that you want to display.
 Hit the Apply Changes button.
 Go ba k to Image Controls and ustomize your style of presentation
As a nal note, keep in mind that both the Color form [x3.3.4℄ and the Mole ule form [x3.3.2℄
an be a essed from the Graphi s form by li king on the buttons lo ated in the upper orners of
the form.

The Tool Sele tion Button


Next to the Apply Changes button on the Graphi s Form is the Tool Sele tion button. This
button allows the tools de ned in the Tra ker form to a e t ertain atom sele tions, rather than
simply a single atom or the entire mole ule. Only one atom sele tion, if any, an be assigned to
the tools. To make the assignment, li k on the desired representation in the browser window so
that it is highlighted, then press the Tool Sele tion button. If you have multiple representations
or multiple mole ules loaded, the button will be lighted only when the assigned representation is
highlighted. To lear the assignment, again highlight the previously assigned representation in the
browser window (when it is found, the Tool Sele tion button should be on) and press the button.
Deleting the assigned representation also has the e e t of learing the assignment.
For information about how the Tools work with atom sele tions, see Tool des riptions [x3.3.11℄.

41
3.3.5 Animate Form
Ea h mole ule displayed by VMD an ontain multiple sets of atomi oordinates, whi h may be
played ba k to animate the mole ule and show its motion. The sour e of the oordinates an be, for
example, from a mole ular dynami s simulation, or simply multiple versions of the same mole ular
stru ture. The Animate form is one way to ontrol the playba k of these traje tories.
The Animate form handles the traje tory playba k of the a tive mole ules [x3.3.2℄. The se ond
line of ontrols ontains ve buttons whi h a t like the buttons on a tape player or VCR. The enter
button (with the square) stops the animation. The button to the right of the stop button advan es
the animation one step forward in the traje tory, and the next button to the right ontinually steps
the animation forward. Similarly, the buttons to the left of the stop button steps the animation
ba kwards either on e or ontinuously. (Just remember that the button that looks like fast-forward
is really the play button, and that the one that looks like the play button is really the single step
forward button.)
The mole ular status shown in this form re e ts the state of the top mole ule. Commands
entered via this form, however, a e t all a tive, not just the top mole ule. This makes it possible
to position several di erent mole ules at the same frame, and to start them in motion at the same
time with one ommand. But, sin e it is not immediately obvious from the information shown in
this form what mole ules will be a e ted, some are must be taken to make sure you have the
proper mole ules a tive that you wish to animate.

Animation Speed
The rate of playba k an be ontrolled in two ways. The Frame Skip ontrols hange the step size.
By default, the frame skip is 1, so ea h step of the playba k in reases (or de reases) the animation
frame number by one. If the frame skip is 5 then the animation pro eeds ve times faster be ause
only 1/5 of the frames are shown.
The Speed slider at the bottom of the form also a e ts the playba k speed. Internally, this
ontrols how many s reen updates are needed between ea h step. By default, the slider is at the
far right indi ating that one step is performed for ea h s reen redraw. Moving the slider to the left
in reases the minimum time required between updates.

Jumping to Spe i Frames


The Start and End buttons are used to simplify the omparison between the initial and nal stru -
tures - Start resets the urrent animation to the rst frame, and End jumps to the last frame. If
you need to jump to a spe i frame, enter the frame number in the Jump To text area and press
enter. One thing to bear in mind is that the frame number starts at 0, so to jump to the 5th frame,
you must a tually enter 4 here.
All of the ontrols a e t the a tive mole ules, but two parts of the animate menu use information
from the top mole ule [x3.3.2℄. There is a display just below the End button whi h shows something
like 0/1 or 23/59. The rst number spe i es the urrent frame number, starting at 0, and the se ond
gives the total number of frames.

Looping Styles
When the animation is playing forward and rea hes the end of the data available for the top
mole ule, one of three possible a tions takes pla e, as spe i ed in the Style hooser. The default

42
is `Loop', whi h will reset the a tive mole ules to the rst frame and ontinue playing forward.
`On e' will stop the animation when it rea hes the last frame, and `Ro k' reverses the dire tion of
animation. The a tions are symmetri al when the animation is playing in reverse.

3.3.6 Edit Animation Form


This form is used to add, save, or delete oordinates sets (also referred to here as frames) from a
mole ule. Usually these oordinates ome from su essive frames of a traje tory but, as shown in
the tutorial A Qui k Animation [x3.3.6℄, an also be distin t onformations of the same stru ture.
When this form is used, it will a e t only the mole ule sele ted in the Sele ted Mole ule hooser.
There are three types of a tions whi h an take pla e; read frames from or write frames to a le
(in the CRD, DCD or PDB format) or delete frames from the urrent animation.

Reading Frames
VMD an read in new oordinate sets from either PDB les (to add a single new frame to the
animation), from as ii CRD les (whi h may ontain several frames), or from binary DCD les
(whi h may also ontain several frames). The new oordinate sets are appended to the end of the
stored animation list for the sele ted mole ule. At present, there is no way to use Babel to append
non-PDB and non-CRD/DCD les. The format is determined by sele ting the appropriate name
in the File Type hooser. If you want to read in all the information from the le, make sure that the
Amount hooser says `All', then press the Read button in the bottom right orner. This will bring
up the le browser so you an sele t the le. (Unlike the Files form, the le is loaded immediately
after the lename is entered in the le browser.)
Sometimes you may not want to read in a whole CRD/DCD le. For example, you may only
want the last frame, or every tenth frame. You an do this by hoosing the `Sele ted' option in the
Amount hooser[x 3.3.6℄. This brings up the frame skip sele tion ontrols. On e you've hosen the
appropriate values, press the Read button to bring up the le browser and nish as mentioned in
the previous paragraph. The Amount options are ignored when reading in PDB les.

Writing Frames
Using the `Write File' a tion, you an write the loaded frames to le in either the PDB or the CRD
ASCII formats, or you may write to a binary le following the DCD format. This may be used
to write out a new traje tory in a single le after assembling many frames from di erent sour es
(su h as PDB CRD, or DCD les, or even from a remote simulation). You an also use this, in
ombination with Read File, as a way to make PDB les from a DCD/CRD traje tory.
You an either save the entire stored traje tory, or a sli e of the data by using the Amount
hooser [x 3.3.6℄. Then sele t the appropriate output le type in the File Type hooser, and press
the Write button in the bottom right orner. This brings up the le browser, whi h you an use to
enter the new lename. On e you press the Write button in the browser, the le will be written
without further on rmation. See se tion on atomsele t ommand [x 13℄ for information on how
to write atom oordinates for an atom sele tion in a PDB le.

Deleting Frames
This provides a way to delete frames from memory. First, hoose the frames you wish to delete with
the Amount hooser and (possibly) the frame skip ontrols, then press the Delete button. There is

43
no on rmation of deletions.
One problem with this me hanism is there is no way to delete every frame ex ept for those
given by the frame skip. You an get around this by writing the skip sele tion to a CRD/DCD le,
deleting all the frames from memory, then reading the skip ba k in from disk.

Amount Chooser
The meaning of this option varies depending on the a tion. If `All' is sele ted, then all the frames
will be read from the le, or all the frames will be written to the le, or all the frames will be
deleted from memory.
The other option is `Sele ted.' This will bring up three ontrols, labeled Begin, End, and Skip.
These make it possible to use a subset of the frames, starting at frame Begin and sele ting every
Skip frames until the End is rea hed. For instan e, to sele t every fth frame between frames 14
and 98, set:

 Begin to 14
 End to 98
 Skip to 5

(Remember that frame numbers in VMD start at 0, so frame 0 is the rst frame.) The value
`-1' is a spe ial number; setting Begin to -1 is the same as starting at the rst frame, End = -1 is
the same as ending at the last frame, and Skip = -1 is the same as taking one step.
When the A tion is `Read File', the sele tion is applied to the frames from the le to be read.
When it is `Write File', the sele tion determines the frames to be written, and when `Delete Frames',
the sele tion determines the frames to be deleted from memory.

3.3.7 Labels Form


This form is used to manipulate the labels whi h may be pla ed on atoms, and the geometry
monitors whi h may be pla ed between atoms. Labels are sele ted with the mouse, as dis ussed
in x3.1.1. On e sele ted, the Labels form an be used to turn di erent labels on or o or to delete
them entirely. Also, labels displaying geometri al data su h as bond lengths may be graphi ally
displayed using this form.

Label ategories
The Category hooser (in the upper left) is used to sele t whi h ategory of labels to manipulate.
The di erent label ategories in lude:
 Atoms, whi h are shown as a text string next to the atom listing the name and residue of the
atom;
 Bonds, whi h are shown as dotted lines between the atoms with the bond length displayed
at the bond midpoint;
 Angles, whi h are shown as dotted lines between the three atoms with the angle displayed at
the enter of the de ned triangle;

44
 Dihedrals, whi h are shown as dotted lines between the four atoms with the dihedral angle
(the angle between the planes formed by the rst three atoms and the last three atoms) shown
at the midpoint of the torsional bond.
 dihedrals
All the labels for the sele ted ategory whi h have been previously added are displayed in the
browser in the enter of the form. The line itself ontains from 1 to 4 atom names, depending
on the ategory; the atom names have the form <residue name><residue id>:<atom name>
followed by either (on) or (off). The last word indi ates if the label is turned on or o .

Modifying or deleting a label


A label an be turned on or o without deleting it, by sele ting the label in the entral browser and
pressing the Hide button. To turn it ba k on, sele t it again then press the Show button. Press the
Delete button to delete it. This browser allows multiple sele tions, whi h, for example, allows you
to delete several labels at on e. To sele t everything in the urrent ategory, press Sele t All; to
unsele t them, press Unsele t All. If nothing is sele ted, the a tion is applied to everything. Thus,
one way to turn everything o is to press Unsele t All then press Hide. (It may seem ounterintuitive,
but it was done this way so all the labels ould be deleted by just pressing Delete.)

Plotting a label's value


If the label has a numeri value (su h as a bond length geometry monitor), it is easy to graph the
hange of the value over time (for multiple frames in an animation). The Graph button reates a
temporary le for use by a graphing program, then optionally starts su h a program to display the
data. Ea h line of the le ontains the frame number (starting at zero and expressed as a oating
point number) followed by the value of the label for that frame.
On e the le is reated, the text in Graph Command is exe uted to plot the data. By default,
the text is xmgr %s, where the %s is automati ally repla ed with the appropriate temporary le
name. When the graphing program nishes, the temporary le is deleted.
The default setup auses VMD to freeze until the graphing program nishes. It is possible to
get around this by in luding an & at the end of the graph ommand, as in:
xmgr %s &
This may sometimes ause a problem be ause VMD might delete the le before the program nishes
reading it. If this is a problem, try:
sh - "xmgr %s &; sleep 4"
to ause VMD to wait a few se onds before deleting the le. You may have to in rease the delay
depending on the le size and type of program used. You may also try variations on the theme; for
instan e
sh - "xterm -e vi %s ; sleep 4"
will bring up a vi window with the data le.

45
3.3.8 Display Form
The Display form ontrols many of the hara teristi s of the graphi s display window. The hara -
teristi s whi h may be modi ed in lude:
 AA { Turns antialiasing on or o . Antialiasing helps smooth out the sometimes jagged
appearan e of lines resulting from the dis rete pixels used to represent a line on the s reen. It
is highly re ommended to leave this on, but on some versions of IRIX (i.e., 6.3) antialiasing
is known to be buggy.
 Depth ue { Turns depth ueing on or o . Depth ueing auses the more distant obje ts to
blend into the ba kground olor. This an help give a 3D e e t when viewing in a non-stereo
mode. Warning: There is a known bug that auses the antialias and depth ue buttons to
stop working. The existen e of the bug is known, but the solution is not (yet). Until this is
worked out, it is suggested to not hange the AA or Depth ue settings.
 Axes { A set of XYZ axes may be displayed at any one of ve pla es on the s reen (ea h of
the orners or the enter) or turned o . This is ontrolled by the Axes hooser.
 Stage { The Stage browser ontrols the stage, whi h is a he kerboard plane that an be
lo ated in any one of six pla es or turned o .
 Detail { The degree of detail in the displayed image. Nothing: show nothing; Points: show
everything as points; Wireframe: show only wireframe representation for spheres, ylinders,
et .; Flat: show a at image (no 3D e e ts); Full: show omplete detail. The performan e
in reases as the level of detail de reases.
 Alt. Detail { Same as Detail, but for the display during mouse operations on the displayed
mole ules, su h as rotation, translation and s aling. Sin e VMD redraws the s reen often
while the mole ule is rotated, it is sometimes bene ial to set lower level of detail for the time
of rotation for better performan e.
 Perspe tive { The view of the s ene an be Perspe tive or Orthographi . In the perspe -
tive view (the default), obje ts whi h are far away are smaller than those near by. In the
orthographi view, both obje ts appear at the same s ale.
 Stereo, Eye Sep, and Fo al L { These ontrols set the stereo mode and parameters; stereo
is dis ussed fully in hapter x9. The Stereo hooser hanges the stereo mode, while the Eye
Sep and Fo al L ontrols hange the eye separation distan e and the fo al length, respe tively.
 Lights { The graphi s display window an use up to four separate light sour es to add a
realisti e e t to displayed graphi al obje ts. The Lights On browser turns these light sour es
on or o . If the number is highlighted, the light is on, and li king on it turns the light o .
See se tin x3.1.1 for more dis ussion regarding lights.
 Clipping Planes (Near Clip and Far Clip) { Clipping o urs when only the part of an
image within a ertain region of spa e is drawn. Only those parts of graphi al obje ts whi h
are between the near and far lipping planes are drawn. This feature is useful for viewing
a sli e of the mole ule. The lipping planes also a e t the depth ueing, if it is turned on.
Obje ts at the near lipping plane are distin t while obje ts at the far lipping plane are
indistinguishable from the ba kground olor.

46
The positions of the lipping planes are hanged with the Near Clip and Far Clip ontrols. It
is not possible for the near lip to be farther away than the far lip. When using stereo, the
near lip should be de reased, or even set to zero.
 S reen Height (H) and Distan e (D) { The s reen distan e parameter determines
the distan e, in `world' oordinates, from the origin to the display s reen. If this is zero, the
origin of the oordinate system in whi h mole ules (and all other graphi al obje ts) are drawn
oin ides with the enter of the display. If it is less than 0, the origin is lo ated between the
viewer and the s reen, while if it is greater than 0, the s reen is lo ated loser to the viewer
than the origin. A negative value puts any stereo image in front of the s reen, aiding the
three-dimensional e e t; a positive value results in a stereo image that is behind the s reen,
a less dramati e e t (but easier to see, for some people) stereo e e t.
The s reen height, along with the s reen distan e, de nes the geometry and position of the
display s reen relative to the viewer. The s reen height is the verti al size of the display
s reen, in `world' oordinates. Ea h mole ule is initially s aled and translated to t within
a 2 x 2 x 2 box entered at the origin; so the s reen height helps determine how large the
mole ule appears initially to the viewer. This parameter is used mainly to on gure the VMD
display to the dimensions and position of a large-s reen display, su h as a proje tor, that may
be used as a stereo display.
Figure 3.17 des ribes the relationship between the s reen height, the s reen distan e, and the
world oordinate spa e.

3.3.9 Color Form


VMD maintains a database of the olors used for the mole ules and the other graphi al obje ts in
the display window. The database onsists of several olor ategories; ea h olor ategory ontains
a list of names, and ea h name is assigned a olor. The assignment of olors to names an be
hanged with this form. There are 16 olors, as well as bla k (the VMD olor map), and this form
an also be used to modify the de nitions of these 17 olors. For more about olors, see the hapter
on Coloring [x6℄.
To see the names asso iated with a olor ategory, li k on the ategory in the Category browser
lo ated on the left side of the form. Cli k on the name to see the olor to whi h it is mapped. To
hange the mapping, li k on a new olor in the browser to the right of the Category browser. For
instan e, to hange the ba kground to white, pi k `Display' in the left browser and `Ba kground'
in the enter one. The right browser will indi ate the urrent olor (whi h is initially bla k for the
ba kground). S roll through the right browser and sele t white to hange the ba kground.

Changing the RGB Value of a Color


Sometimes you may want to hange the RGB value of a olor in the olor map, instead of hanging
whi h olor is assigned to a parti ular name. For example, you may need to make a bla k and
white pi ture and need to emphasize the ontrast between a red oxygen and a yellow sulphur. This
is done with the Edit Colors part of the form. First, hoose the olor you want hanged in the
browser. Then move the red, green, and blue sliders until you get the desired olor. There are a
few additional buttons to help you do this. The white button makes the olor white (red = blue =
green = 1.0) and the bla k olor makes it bla k (red = blue = green = 0.0). The default button
restores the olor to its original RGB values. The tie button is used to make grey olors; when the

47
button is depressed, as you move one slider the rest will follow. Press the tie button again to untie
the sliders.
For example, suppose, we don't really like the appearan e of the green olor and we want to
make it darker. To see what is happening we'll hange the olor of the ba kground, so hoose
Display in the ategory eld of the upper part of the Color form, then hoose Ba kground, and,
nally, hoose green. The ba kground should be ome green. The (default) RGB values are 0.20,
0.70, 0.20. To make the olor darker, let's bring the RGB values down by moving the red, green
and blue sliders to the left. You an see the olor hanging as you move the sliders, so this way
you an easily pi k the olor you prefer to be named 'green'. The de nition an be immediately
brought ba k to the default values by pressing the 'Default' button on the form. Note, that moving
the sliders hanges both solid and transparent ('green' and 'trans green') olors (see Chapter x 6
for details).

Color S ale
Several of the oloring methods in the graphi s form are used to olor a range of values, as ompared
to a list of names. The a tual oloring is determined by the olor s ale [x6.2.2℄.
There is only one olor s ale available at any one time (out of the ten possible) and it is hanged
with the Color S ale Method hooser. Changing the values of Minimum and Midpoint hange some
of the proportionality values used in making the s ale.
The olors used by the olor s ale are not the olors in the olor map, so the Edit Colors part
of the form will not a e t the olor s ale olors.

3.3.10 Render Form


This form is used to reate a le with an image of the urrently displayed graphi s s ene. VMD
an write input s ript les for a number of image pro essing pa kages. These pa kages are listed
in table 8.1. On e VMD reates an input s ript in one of the supported formats, the parti ular
pa kage an use this le to reate a nal output image. See Chapter x 8 for more information on
how rendering is performed.

Rendering
The rendering pro ess works in two stages. The rst step writes an input le for the image
pro essing program sele ted in the Output Formats browser, and the se ond (optionally) starts
the rendering pro ess. The le is given the name entered in the Output Filename eld; a default
name is given when a new format is sele ted, so it is best to hold o entering the lename until
after the le format is sele ted. Another way to sele t the lename is available by pressing the
List... button, whi h opens up a le browser.
Pressing the Go button writes the data le. After that, the Render Command is exe uted. The
default ommand should start the appropriate rendering program if it is available.
The fastest of the urrently supported programs is Raster3D. The rendering ommand for it
has been set up to all the SGI program ipaste when the RGB output le is nished. VMD will
wait for the rendering to nish, whi h auses VMD to freeze, so you may want to run the job in
the ba kground. This an be done by en losing the existing text with ()'s and putting an & at the
end. For example, the way to make the Raster3D render ommand run in the ba kground is:
(render < %s -sgi %s.rgb; ipaste %s.rgb)&

48
Caution
There are some issues to onsider when using the rendering ommands, whi h an lead to dis rep-
an ies between the s ene displayed in the VMD graphi s display window and the image generated
by the image pro essing appli ation. These issues in lude:
 The near and far lipping planes are ignored;
 The olors or intensities may be slightly di erent, due to di erent olormaps, gamma values,
or lighting models;
 The rendering ommands do not urrently support stereo output, so even if the display is
urrently in stereo mode, a non-stereo perspe tive will be used for the rendering program
input s ript;
 Text is generally not available as a graphi s primitive in the image pro essor input s ripts, so
label text will not appear, although the lines of bond, angle, et . labels will be drawn. The
only ex eption is in Posts ript output, whi h supports text output.
 Dotted spheres are not drawn with dots.
 The ba kground olor may be bla k, as not all output formats support a ba kground olor
other than bla k;
 Cylinders will look slightly di erent; in VMD ylinders are drawn as ylindri al polygons
with N fa ets, while they may appear as smooth in the nal output (whi h is generally looked
upon as an improvement!)

3.3.11 Tra ker Form


The Tra ker form is used to set up external 3D pointers, buttons, for e-feedba k devi es, and the
VMD \tools" that they ontrol.

Supported devi es and how to on gure them


VMD urrently an only ommuni ate with devi es in two ways: through the CAVE software or
using the Virtual Reality Peripheral Network (VRPN). VRPN is a system whi h allows workstations
to use many types of devi es over the network. This means that VMD does not have to be running
on the same omputer that the devi es are plugged into. In the CAVE, VMD re ognizes two types
of devi es: buttons and three-dimensional tra kers. With VRPN, you may use buttons, tra kers,
and also for e-feedba k (hapti ) devi es su h as the PHANToM. More types of devi es may be
added in the future.
To use these kinds of devi es with VMD, you need to reate a sensor on guration le, in your
home dire tory, alled .vmdsensors. In this le, any number of devi es an be spe i ed, using a
universal sensor lo ator (USL). The format for a USL is as follows:
 USL { type://pla e/name:nums
 type { the type of sensor (vrpntra ker, vrpnbuttons, vrpnfeedba k, avetra ker, or
avebuttons)

49
 pla e { the ma hine that ontrols it. Devi es that annot yet be used on arbitrary omputers
over the network must have the keyword lo al here to be ompatible with future versions.
 name { the name of the devi e within that ma hine. If multiple devi es an't urrently exist,
su h as with the CAVE, then a standard name should be used, su h as ave, so that the
same USL will make sense in the future, when multiple devi es are allowed.
 nums { a omma-separated list of numbers of devi es belonging to that names (optional,
defaults to zero). Some devi es demand only one number or a spe i number but button
devi es should work orre tly now.
The lines of a sensor on guration le ome in four avors:
 Comments begin with # and are ignored.
 Empty lines are also ignored.
 Devi e lines have the form devi e name USL, where name is the name that VMD will use
to refer to the devi e, and USL is the devi e's USL.
 Options tell VMD how to use the most re ently listed devi e. Currently, there are four
supported options:
{ \s ale x" s ales the position of a tra ker by a fa tor x.
{ \offset x y z " adds a onstant ve tor to the position of a tra ker.
{ \rot right|left A00 A01 : : : A33 " multiplies the orientation matrix returned by a
tra ker on either the right or the left by the matrix A.
{ \for es ale x" multiplies the for e applied to a for e-feedba k devi e by the amount x.
Here is an example, showing all the possible things you an do with a sensor on guration le:
# the PHANToM onne ted to the omputer "odessa"
devi e phantomtra ker vrpntra ker://odessa/Phantom0
s ale 10
rot left 0 0 -1 0 1 0 1 0 0

devi e phantombuttons vrpnbuttons://odessa/Phantom0


devi e phantomfeedba k vrpnfeedba k://odessa/Phantom0

# Polhemus fastrak on titan


devi e fastrak1 vrpntra ker://titan/Tra ker0:0
rot right 0 0 1 1 0 0 0 1 0
rot left 0 0 -1 -1 0 0 0 -1 0
devi e fastrak2 vrpntra ker://titan/Tra ker0:1
rot right 0 0 1 1 0 0 0 1 0
rot left 0 0 -1 -1 0 0 0 -1 0

#### Configuration for the CAVE


# CAVE tra ker

50
devi e avetra ker avetra ker:// ave/ ave
s ale 0.32
offset 0 -3.03 0

# CAVE buttons
devi e avebuttons avebuttons:// ave/ ave:0,1,2,3

# CAVE buttons (for left-handers)


devi e avebuttons avebuttons:// ave/ ave:3,2,1,0

Using devi es with VMD


There are several di erent \tools", ea h of whi h an be used with any of the input devi es1 :
 The Grab Tool mimi s a pair of tweezers, and an be used to move mole ules around on
the s reen without any keyboard or mouse ommands. Pressing a button onne ts the 3d
ursor to the nearest mole ule. Then, moving or rotating the tra ker will ause the mole ule
to move or rotate around on the s reen.
 The Rotate Tool is a tool for pre isely rotating mole ules with hapti devi es. When a
button is pressed and released, the ursor is again onne ted to the mole ule. With this tool,
however, the enter of the mole ule is xed, and the end of the hapti pointer is for ed to
lie on the surfa e of a sphere about this enter. Moving the devi e around the surfa e of
the sphere rotates the mole ule, and another button li k releases the mole ule. There are
detentes | like the li ks ommonly felt in a 2d dial | on the surfa e of the sphere, arranged
so that the user an rotate the mole ule to pre ise 90-degree points. If the user holds down
the button for a while initially, he an feel the sphere and the detentes, but do not a e t the
mole ule. This \preview mode" allows the user to nd a good point from whi h to start the
rotation.
 The Joysti k Tool is the three-dimensional equivalent of a Joysti k, for hapti devi es.
Pressing the button reates a virtual \spring," holding the devi e to its urrent lo ation. If it
is pushed away from this point in some dire tion, the sele ted mole ule starts sliding in that
dire tion, with a velo ity that is proportional to the displa ement of the devi e. The joysti k
tool shows how a three dimensional input devi e an be used to supply relative (di erential)
oordinates instead of absolute oordinates.
 The Tug Tool is a tool that allows intera tion with running mole ular dynami s simulations.
Pressing the button onne ts the devi e with a simulated spring to the nearest atom, and
pulling on it adds a for e to the simulation. If a hapti devi e is being used, the user will feel
a for e on his hand that is proportional to this for e. In this way, the tug tool implements
something like the li k-and-drag that is ommonly used with windowing systems.
If an atom sele tion is assigned to the Tools, as des ribed in se tion 3.3.4, the the Tug Tool
will apply a for e to all the atoms in the sele tion. The for e applied will be proportional to
the masses of the atoms in the sele tion, so that all atoms experien e the same a eleration.
When a Tool Sele tion has been assigned, the Tug Tool will always a e t that sele tion, even
1
The new tools have been designed to allow VMD to use hapti devi es in many ways. All of the tools an give

for e-feedba k to the user, but none of them a tually require hapti devi es to work.

51
if the button is pressed far from any atoms in the sele tion; this is intended to make it easier
for the user to apply for es only on those atoms he/she intends to steer.
 The SMD Tool is a tool intended for use with steered mole ular dynami s (SMD). It allows
the user to pull on atoms in only one dire tion, so that the for es and motions of the mole ule
an be more easily analyzed. The user li ks at a \target point", drags the pointer ba k to
the atom he wishes to pull on, then releases the button. The tool now behaves like a tug
tool, but for es are restri ted to lie parallel to the line through the atom and the target point.
Using the SMD tool with a hapti devi e feels like pushing against a non-rotating, fri tionless
plane, sin e the for es applied to the user's hand must also all point parallel to this line. The
for e applied and the position of the atom are automati ally re orded to the le pull.txt.
To add a new tool to a VMD session, open the tra ker form and li k the Create Tool button.
The tool's number and type are displayed in the list to the left. Devi es an be added to the tool by
sele ting them from the Add Devi e menu, or removed with the Delete Devi e button. Some of
the options that an be spe i ed in the sensor on guration le an be edited in using the ontrols
below, and the tool's type an be hanged with the Type menu.

3.3.12 Sim Form


As des ribed in the hapter on Intera tive Mole ular Dynami s [x15℄, VMD has the apability to
work with a mole ular dynami s program running on another omputer, in order to display the
results of a simulation as they are al ulated.
The Sim form allows you to ontrol the behavior of a mole ular dynami s simulations whi h has
been previously onne ted to through use of the Remote form. This form ontains ontrols to hange
parameters for the simulation and to a e t how VMD displays the results of the simulation. The
form also ontains informative displays, whi h show the urrent status of the simulation onne tion,
and su h things as the urrent energy, temperature, and timestep of the mole ular system being
simulated.
At the top of the form, the host ma hine, if any, of the mole ular dynami s simulation to
whi h VMD is onne ted is displayed. Below the onne tion display is a browser used to set some
onne tion parameters. These in lude:
 Transfer Rate: How often a timestep is transferred from the remote simulation program
to VMD. By default, this is 1, whi h means every al ulated timestep is sent. If this is set
to some value N, then only every Nth step will send from the remote omputer. If you have
the dubious misfortune of re eiving oordinates faster than VMD an pro ess them, or if you
simply don't are to re eive oordinates very often, setting this transfer period higher will
improve the performan e of both VMD and the simulation.
 Keep Rate: How often VMD saves the timestep in its animation list, instead of just dis-
arding it after displaying it. By default, this is 0, whi h means that VMD does not save any
frames. When this is 0, then when VMD re eives a new frame it repla es the last frame in the
animation list with the new frame, instead of appending it. When it is set to some number
N larger than 0, then every Nth frame re eived from the remote simulation will be appended
to the animation list, instead of being used to repla e the last frame.
To hange a parameter, sele t the line with the relevant parameter, and in the text entry area
that appears enter the new value and press <return>. After you enter a new value, a ommand

52
will be sent to the remote simulation to hange it, and there may be some delay between when the
simulation gets the ommand, a ts on it, and the results propagate ba k to VMD.
In the entral portion of the form is shown a status message for the hosen onne tion. A large
browser near the bottom of the Sim form displays the di erent energy values for the system being
simulated (kineti , ele trostati , et .), as well as the urrent timestep and the temperature. It is
automati ally updated ea h time a new atomi oordinate set (timestep) is re eived and stored in
the VMD animation loop.
At the bottom of the Sim form are two buttons:
 The Kill button, whi h when pressed will terminate the remote simulation whi h is urrently
sele ted in the onne tion hooser. This will not delete the mole ule stored in VMD's internal
lists, it will just stop the remote program from exe uting (and thus stop the transfer of new
timesteps from that program to VMD). You must go to the Mole ule form and delete the
mole ule from that list to ompletely remove the mole ule from VMD memory.
 The Deta h button, whi h when pressed will sever the onne tion between VMD and NAMD,
but will NOT kill the NAMD pro ess. Instead, the simulation will be left running.

3.4 Other User Interfa es


VMD is the visualization omponent of MDS ope whi h is an intera tive environment for mole ular
modelling and dynami s. As part of that proje t we are experimenting with new modes of human-
omputer intera tion. Most programs use the mouse and menu user interfa e omponents, or even
a dial box (whi h, by the way, VMD does not urrently support - anyone want to give us one?)
but these do not fully support the full range of ontrol needed for modelling. We envision a system
where a ligand an be pi ked up and inserted dire tly into an a tive site, or where one an point
to a mole ule and say \whi h helix is that?"

3.4.1 External Interfa es


We have developed a simple me hanism to re eive external text ommands. It is based on the T l
extension pa kage, T l-DP, whi h adds ommands to interfa e with standard so ket ommuni a-
tions. It allows other programs to send messages to VMD and be interpreted as if they originated
from the keyboard. If the ommand returns information, that data is sent ba k to that alling
pro ess.
The external interfa e works by setting up VMD as a server for remote exe ution of a T l
ommand (VMD is a T l-DP RPC server). Other pro esses an onta t VMD by onne ting to a
port. The remote pro ess sends a text ommand to VMD whi h interprets it and sends the result
ba k to the remote pro ess, whi h an do with it as it may.
The ommand external on starts VMD as a T l-DP RPC server. When an external pro ess
attempts to onne t, the alling hostname is he ked to see if it is allowed to run ommands on the
lo al ma hine. If so, the ommand is run. Note that external off does not dis onne t urrently
atta hed pro esses, it only disallows new ones.
There is a simple se urity me hanism in the external ommand whi h derives from the standard
T l-DP se urity. This allows or denies new onne tions based on the host name of the alling pro ess
and uses the ommand external host.
There are two ways to make a lient that onne ts to VMD. The rst is to use VMD itself. The
ommand external onne t <hostname> will onne t to a VMD pro ess on the given ma hine.

53
The pro ess that started the onta t is the lient VMD and the one that was onta ted is the server
VMD. The other way is to use a T l based shell whi h has T l-DP ompiled in. Sour e (or look
at) the le $env(VMDDIR)/s ripts/vmd/external.t l to see how the DP alls are made.
The lient pro ess sends a new ommand to the server with the ommand external send
< ommand>.

54
55
Figure 3.9: The Mole ules form

Figure 3.10: The Files form

Figure 3.11: The Graphi s form (in Image Controls mode)

56
Figure 3.12: The Graphi s form (in Atom Name Lists mode)

Figure 3.13: The Animate form

57
Figure 3.14: The Edit Animation form

Figure 3.15: The Labels form

58
Figure 3.16: The Display form

59
4/3 SCRHEIGHT
i.e. 8.0

Z
SCRDIST
Viewer’s X i.e. -2.0
Eye Position

SCRHEIGHT
i.e. 6.0

Figure 3.17: Relationship between s reen height (SCRHEIGHT), s reen distan e to origin
(SCRDIST), and the viewer

Figure 3.18: The Color form

60
Figure 3.19: The Render form

Figure 3.20: The Tra ker form

61
Chapter 4

Loading A Mole ule


The Files form is the primary means for loading a new mole ule into VMD from one or more data
les. VMD natively understands ve mole ular data le formats: PDB oordinate les, CHARMM
and X-PLOR style PSF (topology) les, CHARMM and X-PLOR style DCD traje tory les, and
Amber stru ture and traje tory les (i.e. PARM and CRD). These les ontain some redundant
information and an be loaded in di erent ombinations.
The PDB le ontains data about the atom, residue, and segment names, the o upan y and
beta fa tor, and one oordinate set. The PSF and PARM les list the atom, residue, and segment
names, the residue type, atomi mass and harge, and the bond onne tivity. The DCD and CRD
les ontain only the atomi oordinates over multiple frames (timesteps).
When VMD loads a le it requires information about atom names and oordinates and tries to
ll in the rest. Sin e the PDB le ontains all this information, it does not need to be loaded with
any other data les. However, the PDB le doesn't ontain the atom types, masses, and harges,
so these are guessed.
A PSF le does not ontain oordinate information so it must be loaded along with a PDB or
DCD le. If a PDB and PSF are given there is no missing data and VMD makes no assumptions.
If a PSF and DCD are given then only the hain identi er and o upan y and beta values are
missing so they are given a default value.
A PARM le is similar to a PSF in that it too ontains no oordinate information. It must be
loaded along with an CRD traje tory le. If a PARM and CRD le are loaded together, then only
the segname and hain ID for the atoms are left blank. VMD lls in the remaining elds expli itly,
making no assumptions.
A CRD or DCD le an be spe i ed along with the PDB, in whi h ase the PDB le will be
read as normal, and then oordinate sets are read from the DCD or CRD until the end of the le
is rea hed.
Additional oordinates from a PDB, CRD, or DCD le an be appended to the urrent oordi-
nate set using the Edit form [x3.3.6℄.

4.1 Babel interfa e


VMD an use the program Babel, if installed, to translate a wide variety of di erent mole ular data
les into the PDB format. Babel, written by Pat Walters and Matt Stahl, an onvert between
many types of mole ular data les. Not all of these have been tested for use with VMD, so your
results may vary. Some data formats, su h as XYZ, ontain a series of oordinates. Babel onverts

62
these to a series of PDB les whi h VMD then reads as an animation. For more information about
Babel, see http://www.eyesopen. om/babel.html VMD supports version 1.6 of Babel. Older
versions of Babel will not work orre tly with VMD.
VMD at present has no provision for using Babel to onvert the output PDB CRD, or DCD les
to anything else (see se tions x3.3.6, x 10.3.1 and x 13.2 for information on writing output les).
The Babel-VMD interfa e uses two environment variables [x17.2℄, VMDBABELBIN and VMDTMPDIR.
The rst spe i es the absolute lo ation for the Babel binary (i.e. it must in lude the name of the
exe utable itself, su h as /usr/lo al/bin/babel). The se ond de nes the lo ation for the temporary
PDB les made by Babel.

4.2 What happens when a le is loaded?


(See the Files form x3.3.3 for instru tions on how to spe ify input les. See the the Edit form [x3.3.6℄
for instru tions on how to save data as either a PDB, DCD, or CRD le. The Edit form an also
be used to append [x3.3.6℄ PDB and DCD les to a loaded mole ule.)
If only a oordinate le (i.e. just a PDB, with no PSF) is given, two passes are made through
the le. The rst pass determines how many atoms exist and the se ond reads them in. VMD then
uses internal defaults to ll in the missing values. It then does a distan e sear h to determine the
bond onne tivity, whi h will make some strange bonds if atoms are too lose. If both a PSF and
a PDB le are given, no approximations or guesses are made. For those interested in the details,
when VMD is for ed to guess the onne tivity, it onsiders a bond to be formed whenever two
atoms are within R1  R2  0:6 of ea h other, where R1 and R2 are the respe tive radii of andidate
atoms.
After the mole ule is read, VMD he ks to see if any new names are needed for the various
oloring ategories [x6.2.1℄. If so, they are reated and assigned a new olor. (When the end of
the olor list is rea hed, the olor starts again at the beginning.) Next, the bond onne tivity is
established and the mole ule is analyzed to identify the various omponents, i.e., determine whi h
residues are protein, nu lei a ids, and waters, whi h atoms are ba kbone atoms, et . A sear h
is then made to onne t these di erent types into larger fragments of the same type. As these
sear hes take pla e, the information is printed to the s reen. An example output for BPTI is:

Info 1) Analyzing stru ture ...


Info 1) Atoms: 898 Bonds: 909
Info 1) Ba kbone bonds: Protein: 231 DNA: 0
Info 1) Residues: 58
Info 1) Waters: 0
Info 1) Segments: 1
Info 1) Fragments: 1 Protein: 1 Nu lei : 0

There are a tually several types of fragments. Protein and nu lei fragments are homogeneous;
either all proteins or all nu lei a ids. However, it is quite possible for a protein to be onne ted to
a nu lei a id or some other non-protein. When this o urs, a warning message is printed, as in:
Warning 1) Unusual bond between residues 1 and 2
These warnings are known to o ur with terminal amino a ids, zin ngers, myristolated
residues, and poorly de ned stru tures.

63
4.3 Raster3D le format
In addition to the mole ular le formats, VMD an read the input le for Raster3D. (Raster3D
onverts an input le into a shaded raster image for use in making high quality pi tures. It is often
used with MolS ript.) The ability to read Raster3D allows users to view MolS ript les in 3D and
in orporate spe ial images into the display without having to edit the VMD ode. If anyone has
used this se ond option, we would be interested in knowing what was done.
The le format, whi h is part of the Raster3D do umentation, des ribes a simple olle tion of
triangles, spheres, and ylinders with either at or spheri al ends. Ea h shape is olored by an
RGB triplet.

4.4 Raster3D Caveats


Certain newer Raster3D obje ts are ignored, su h as quadri s. Also, nearly all of the header
information is ignored|most notably, the viewing matrix.
Aside from quadri s, VMD an read and display all shapes in the format with one ex ep-
tion. Raster3D uses many ylinders with spheri al (rounded) ends. VMD deliberately omits these
rounded ends sin e the resultant image would be very slow.
Finally, sin e VMD uses a palette of 16 olors, ea h triplet is onverted into its \nearest" indexed
olor. This may ause images to be olored slightly di erently than expe ted.

64
Chapter 5

Mole ular Drawing Methods


Ea h mole ule in VMD is drawn as several representations, or views, of the mole ule. A view is
just one parti ular way of drawing the mole ule, and onsists of three hara teristi s:
 A rendering method (representation style), whi h determines what shape to draw the atoms,
bonds, and other omponents of the mole ule. This hapter des ribes the di erent rendering
methods available in VMD.
 A oloring method, whi h determines how to olor ea h of the atoms and bonds in luded in
the view. The Graphi s form ontains ontrols to set the oloring method at the right of the
form. Chapter x 6 des ribes the di erent oloring methods.
 An atom sele tion, whi h determines whi h of the atoms in the mole ule will be in luded in
the view. This sele tion is entered in the text input eld at the bottom of the Graphi s form.
Chapter x 7 des ribes the syntax used to sele t atoms.
A mole ule an ontain any number of di erent representations, and omplex pi tures of the
mole ule an be generated by reating views with di erent sele tions, oloring s hemes, and ren-
dering methods. For example, the protein ba kbone an be drawn as a smooth tube in one view,
and important residues in the protein an be drawn as spheres or li ori e bonds in other views.
When a mole ule is rst loaded, it is given a `default' view, whi h will draw all the atoms as lines
and points, oloring ea h atom by what kind of element it is.
All of the di erent rendering methods have various parameters whi h determine how they are
drawn. For ea h method, there are ontrols in the Graphi s form whi h modify the asso iated
parameters, su h as the line width and sphere resolution (the graphi al ontrols are des ribed in
se tion x3.3.4). Table 5.1 lists the available rendering methods, and the following se tions des ribe
these methods and the parameters whi h modify their appearan e.

5.1 Lines
The default representation is `Lines', whi h is also known as `wireframe'. It draws a line between
ea h atom and the atoms to whi h it is bonded. Both atoms have to be sele ted before the bond
will be drawn. The rst half of ea h bond is olored appropriately for the rst atom, while the
olor of the nal half orresponds to the se ond atom.
The only parameter for this option is the line thi kness. On some SGIs you will only noti e a
di eren e between settings of 0, 1, and 2. Anything beyond 2 looks the same as 2. To understand

65
Representation styles Des ription
Lines simple lines for bonds, points for atoms
Bonds lighted ylinders for bonds
CPK s aled VDW spheres, with ylinders for bonds
Points just points for atoms, no bonds
VDW solid van der Waal spheres for atoms, no bonds
Dotted dotted van der Wall spheres for atoms, no bonds
Solvent dotted representation of the solvent a essible surfa e
Tra e onne ted ylindri al segments through C atoms
Li ori e spheres for atoms, ylinders for bonds, same radius
Ribbons at ribbon through the C atoms
Tube smooth ylindri al tube through the C atoms
Cartoon artoon diagram ( ylinders and ribbons) based on se ondary stru ture
MSMS mole ular surfa e as determined by the program MSMS
HBonds display hydrogen bonds
Surf mole ular surfa e as determined by SURF
O do not draw anything
Table 5.1: Mole ular view representation styles.

why, you should see the man page for linewidth (look at an ex erpt from that man page in se tion
x12.1).

5.2 Bonds
Nearly everything about this option is the same as lines ex ept that instead of drawing a bond as
a line between two atoms, a ylinder is drawn instead. To be more spe i , it draws an n-sided
prism, where the number of sides is determined in the Graphi s form by the \Bond Res" ontrol
and the radius is given by the value of \Bond Rad," in Angstroms. If the radius or number of sides
gets too small, the bonds are drawn as lines.
In order to ne tune the bond representation, VMD does a small amount of tri kery to the
prisms. That is, imagine two hollow ylinders oming together so that the enter of the fa e of one
ylinder is in the same position as the enter of the fa e of the other ylinder. Also suppose these
two ylinders ome together at 90 degrees. Although most of these two ylinders will overlap, there
will appear to be a gap at their interse tion.
To orre t for this problem, VMD extends both ylinders somewhat so that the far ends tou h.
If one looks losely, this produ es more of an overlap, but it is mu h ni er looking than the gap.
When three or more bonds join at one atom, VMD hooses the lowest numbered bond and extends
all other bonds to meet with that one. It then extends that lowest numbered bond to meet with
the se ond lowest numbered one. A bit te hni al, but not too diÆ ult to do.

5.3 CPK
`CPK' is a ombination of both `Bonds' and `VDW' in that it draws the atoms as spheres and the
bonds as ylinders. The resolution and radius an be modi ed independently. The radius of the
sphere drawn in CPK mode is by default smaller than the sphere drawn in VDW mode, but this

66
radius an be made larger. Sin e a sphere is drawn for ea h atom, it will always be slower than
the VDW option, but we will work on performan e for future versions. If the values for a sphere
or bond attribute are too small, then those obje ts will not be drawn.

5.4 Points
`Points' draws ea h atom as a point, and does not draw any of the bonds. This option is not terribly
useful.

5.5 VDW
`VDW' draws the atoms as spheres. The radius used is the van der Waals radius multiplied by a
user-sele table s aling fa tor. The sphere resolution determines how nely to tessellate the spheres
that are drawn. Drawing spheres takes some time, sin e they are built from a olle tion of triangles
produ ed by a sphere library external to GL/OpenGL.
For those of you interested in the details, what happens is as follows: At the most primitive level,
the sphere drawing algorithm starts with a shape, su h as a square bipyramid (two pyramids with a
square base joined base-to-base). Then a re ursive bise tion is applied to this shape, where at ea h
level of re ursion, given a triangular fa e, the endpoints of the enters are omputed and s aled so
as to be on the surfa e of the sphere. Given these endpoints and enters, one an onstru t four
sub-triangles, whi h themselves are subje t to bise tion on the next level of re ursion. A diagram
illustrating these on epts is given below.

Subdivide ea h triangle in the old approximation and normalize


the new points thus generated to lie on the surfa e of the unit
sphere.
Ea h input triangle with verti es labeled [0,1,2℄ as shown
below will be turned into four new triangles:

Make new points


a = (0+2)/2
b = (0+1)/2
= (1+2)/2

Normalize a, b,
a = (0+2)/2
b = (0+1)/2
= (1+2)/2
1
/\ Normalize a, b,
/ \
b/____\ Constru t new triangles
/\ /\ [0,b,a℄
/ \ / \ [b,1, ℄
/____\/____\ [a,b, ℄
0 a 2 [a, ,2℄

67
The \Sphere Res" setting is a tually ontrolling the number of levels of re ursion being applied.
Note:: Due to variations in atom naming onventions, in rare instan es VMD may improperly
assign VDW radii to spe i atoms, sin e VMD determines ea h atom type based on the rst letter
forming its name. For example, VMD would assume an atom named \HG" to be a hydrogen rather
than a mer ury. If this happens, you are always free to rede ne the radii, using a syntax mu h like
that below:
set sel [atomsele t top ``name HG''℄
$sel set radius 1.9

5.6 Dotted
Same as `VDW' ex ept that the spheres are drawn dotted instead of solid. That is, a dot is pla ed
at ea h of the verti es of the triangle making up ea h sphere. This an be used, for instan e, to
imitate a surfa e representation.

5.7 Solvent
This method is similar in spirit to the Dotted representation in that it gives a qui k estimate of
the mole ular surfa e with a olle tion of dots. However, it goes above and beyond the Dotted
option by giving a more uniform overage of the surfa e. The method that VMD uses to he k for
overlaps isn't te hni ally orre t, but it is fast and works quite well. A te hni al des ription of the
algorithm is as follows:

For ea h point of the surfa e distribution (of radius r = atom radius + probe radius) of atom
i, he k ea h of the atoms j to whi h it is ovalently bound. If the point is too lose to j , don't
display it. Also, if the point is too lose to any neighbor k of j (k 6= i) then don't draw it. This
is fast sin e there aren't that many neighbors to he k, but it doesn't omit parts of the surfa e in
onta t with atoms whi h aren't one or two bonds away. This an be onsidered a good thing sin e
you might get a better idea of the onta t surfa e.
There are three parameters for this option. One is the probe radius, whi h was mentioned
in the des ription. If the probe radius is too large, the problem of over-lapping surfa es between
non- onne ted atoms be omes more apparent. The se ond is "Detail", whi h should probably be
renamed "Density" as it determines the surfa e density of the distributions. The higher the detail,
the higher the density. The nal option is the "Method". By default the surfa e is drawn as a
olle tion of points, but a point is a pixel in size regardless of the s ale of the mole ule, so when
s aled small the surfa e density appears high, and when s aled large, the density appears low.
Method 2 draws little plus signs instead of points, whi h does s ale better so the density appears
more ontant. Method 3 draw lines between the surfa e points that are on the same atom, but
makes no attempt to onne t the two spheres.
Thanks to Jan Hermans for implementation pointers and thanks again to Jon Lee h for the ode
to ompute the uniform point distributions. That ode was in luded as part of the 1.x distribution.

68
5.8 Tube
There are two ways to draw a `Tube' representation, one for proteins and the other for nu lei
a ids. The protein tube is a smooth urve through the sele ted C positions, and the nu lei a id
tube is a smooth urve through the ba kbone phosphates.
The protein tube is a spline urve that passes through all the C s in a protein fragment. Five
evenly spa ed interpolation points are found along the urve to break the urve onne ting the two
C s into six line segments. If the rst C is sele ted, the rst three segments are olored by the
olor assigned to that C . If the se ond C is sele ted, the last three segments are olored by the
olor of the se ond C . The nu lei a id tube is onstru ted in the same manner ex ept that the
phosphate atoms are used.
The two ontrols set the spline radius and resolution and have the same meaning as they did in
the `Bond' ontrol. However, if the bond radius be omes 0 or the bond resolution is 2 or less then
the spline is drawn as a simple line. This make moving and rotation the image mu h faster.
It is possible to pi k with the mouse the C whi h de nes the tube by li king near the middle
of the six tube segments whi h are asso iated with that atom.

5.9 Tra e
This representation applies mu h of the pro edure used to onstru t the Tube. In the end, it
onne ts the alpha- arbon atoms of su essive residues by ylindri al segments with adjustable
width. In the ase of nu lei a ids, it is the P ba kbone atoms whi h are onne ted. As always, the
segment pie es are olored a ording to the atom they are asso iated with. If the ylinder radius
is made 0.00, then the ylinder segments are repla ed with lines.
Note: the Tra e option is useful for people doing threading or protein folding work who only
look at the C oordinates and residue names, for then they don't have to build the side hains
ne essary to see their stru ture. Also, people working on polymers an fake their stru ture by
naming everything \CA." in the PDB le and then using Tra e.

5.10 Li ori e
`Li ori e' draws the atoms as spheres and the bonds as ylinders. The di eren e between this and
`CPK' is that the sphere radius is not ontrollable; instead, it is made the same size as the bond.
This makes for a ni e, smooth transition and is one of the most often used representations. It an
be rather slow for large mole ules.

5.11 Ribbon
The `Ribbon' representation is similar to `Tube' in that it follows the same spline urve for both the
protein and nu lei a ids. However, it uses additional information (the O of the protein ba kbone
or some of the phosphate oxygens for nu lei a ids) to nd a normal for drawing the oriented
ribbon. (There may be some problems with the ribbon de nition for nu lei a ids as it is possible
for the nu lei a id dete tion routine to label a residue as a nu lei a id even though it does not
have phosphate oxygens.)
Given the oordinates of ea h atom and the o set ve tor for the ribbon ve tor, the drawing
ode nds the spline urves for the top and bottom of the ribbon. The two splines are onne ted

69
by triangles and both splines are drawn as small tubes. As with the `Tube' representation, the six
ribbon segments nearest the given atom are drawn with the olor assigned to that atom and the
atom an be sele ted by li king near the enter of those six elements.
Bond radius and resolution modify the tubes that make up the top and bottom of the ribbon.
If the radius or resolution get too small, the tubes are not drawn (this speeds up drawing time by
an appre iable amount). The line thi kness ontrols the width of the ribbon and make it look like
everything from vermi elli to lasagna. Additionally, the sugars are drawn lled in with triangles.
This helps highlight the pu ker.
Thanks to Ethan Merrit for the ribbon drawing algorithm taken from Raster3D.

5.12 Surf
This option uses the mole ular surfa e solver written by Amitabh Varshney when he was at the
University of North Carolina. When this option is used, the radii and oordinates are written to
a temporary le and the 'surf' exe utable is run with the probe radius as a parameter. When
nished, the output is written to another temporary le whi h is then read by VMD and olored
and displayed. The value of the probe radius is ontrolled by the sphere radius, and this is identi al
to the probe size in 
A.
This surfa e is rather slow in both generation and display for systems over several hundred
atoms. The SURF al ulation is quite exa t and will show omplete detail even when it isn't
needed. The use of disk spa e as a ommuni ations medium takes up about half the time, and the
method used to draw the triangles has not been optimized.
There are two environment variables whi h an a e t the Surf display option:
 SURF BIN { lo ation of the SURF binary (defaults to SURF $ARCH as de ned in the vmd startup
s ript)
 SURF TMPDIR { lo ation of the dire tory to use for temporary les (defaults to the value of
the environment variable VMDTMPDIR, whi h defaults to /tmp)
A helpful tri k when onstru ting surfa es is to use the \Apply Changes Automati ally" toggle
button on the graphi s form wisely. That is, sin e surfa es often take a long time to build, hanging
viewing parameters su h as the probe radius an ause long delays. By default, ea h time you hit
the probe radius button, VMD rebuilds the surfa e. If you want to redu e or enlarge the probe
radius by several in rements, then you would end up rebuilding the surfa e multiple times. By
toggling the afore-mentioned button, you an for e VMD to update on your ommand only. This
tri k is sometimes helpful with other representations as well.
For a faster though arguably more impre ise surfa e rendering method, see the des ription of
MSMS below.

5.13 Cartoon
The `Cartoon' option produ es a simpli ed representation of a protein based on its se ondary
stru ture. Heli es are drawn as ylinders, beta sheets as solid ribbons, and all other stru tures
( oils and turns) as a tube. If the se ondary stru ture has not yet been determined, it will be
al ulated automati ally by the program STRIDE.

70
A helix ylinder is onstru ted by nding the least squares linear t along the oordinates
of the helix's C atoms. If a given residue's C is sele ted, the small ylinder (found by linear
interpolation along the line of best t) is drawn with radius determined by the ??? parameter.
Be ause this method omputes a best t, a helix must have at least 3 residues before it is drawn
(those heli ies with one or two residues are drawn as a oil). It is possible to pi k the C for
ea h ylinder segment, but they are at the lo ation of the C , whi h is not near the axis ylinder.
Interesting results o ur when the whole protein is de ned to be a helix and drawn as a artoon.
The solid beta ribbon is onstru ted by building a spline along the enter points between ea h
beta sheet residue. Again, the spline is linearly interpolated to nd the start and end points for ea h
residue. Those are extended to onstru t the orners for a ribbon with re tangular ross se tion
(the amount of extension is determined with the ??? parameter). A ribbon segment is used if the
orresponding C atom is sele ted. Note that sin e this method assumes the protein is in a beta
onformation, it draws a mu h smoother ribbon than the standard Ribbon option, whi h draw the
ribbon with an os illation along the sheet.
The other onformations are drawn as a tube. Sin e the endpoints of the helix ylinder and
artoon sheet are not at the C oordinate, the tube method was slightly hanged to make the
tube go to the new lo ations. This does not always work, resulting in a tube whi h does not quite
onne t to a ylinder.

5.14 MSMS
Another mole ular surfa e renderer is MSMS, a program written by Mi hael Sanner of Olsen's lab
at S ripps. This program is mu h faster than the Surf ode in both generating the initial surfa e and
then in manipulating the surfa e after it is built. See the web page http://www.s ripps.edu/pub/olson-
web/people/sanner/html/msms home.html for more details. Available options in lude
 All Atoms { should the surfa e be of the sele tion (0) or of the ontribution of this sele tion
to the surfa e of all the atoms? (1)
 Density { triangle density on the surfa e (typi al values are 1.0 for mole ules with more than
one thousand atoms and 3.0 for smaller mole ules)
 Probe { Probe radius used to onstru t the mole ular surfa e

5.15 HBonds
The HBond representation will draw a dotted line between two atoms if there is a possible hydrogen
bond between them. A possible hydrogen bond is de ned by the following riteria:
Given an atom D with a hydrogen H bonded to it and an atom
A with no hydrogen bonded to it, a hydrogen bond exists between
A and H iff the distan e ||D-A|| < dist and the angle D-H-A < ang,
where ang and dist are user defined.
Only the sele ted atoms are sear hed, so both the donor and a eptor must be sele ted for the
bond to be drawn. Also, you'll note that the above doesn't he k the atom type of the donor or
a eptor; the only riterion is if it already has or doesn't have a hydrogen.

71
One downfall of the urrent implementation is that it does an n2 sear h of the sele ted atoms
so you probably don't want to show all the HBonds of a very large stru ture. Look for performan e
improvements in future versions of VMD.
If you hoose an HBonds representation but fail to see any hydrogen bonds, it may be be ause
the default angle and distan e riterion in VMD are too small, so you might want to try in reasing
the angle value from 20 to 30 degrees and the distan e value from 3 to 4.
The HBonds are drawn as dotted lines of a given width. The default is 1 but you should
probably in rease that to 2. On most SGIs you an't make it any wider than that, as des ribed in
the man page for linewidth. The bond is olored by the olor asso iated with the a eptor.

5.16 O
The `O ' representation draws nothing. It is used in pla e of delete to hide a sele tion so it an be
redisplayed qui kly later.

72
Chapter 6

Coloring Mole ules and Obje ts


VMD maintains a database of the olors used for the mole ules and other graphi al obje ts whi h
are visible in the display window. It keeps tra k of
 olor name de nitions - RGB, alpha value, et .
 mappings from a olor ategory to olor name - so residue name MET is olored yellow
 the urrent olor s ale - red to white to blue, and several related parameters
There are 98 olors available in VMD, with olor ids ranging from 0 to 97. Of these, 34 are
named. The rst 17 (with values 0 to 16) are, in order: blue, red, gray, orange, yellow, tan, silver,
green, white, pink, yan, purple, lime, mauve, o hre, i eblue, and bla k. The next 17 (with olor
indi es from 17 to 33) are translu ent (partially transparent) versions of the same terms. The
names for these are the same as the solid olor, pre xed with the word \trans ". For example, the
translu ent version of \yellow" is \trans yellow".
The next group of 32 olors (from 34 to 65) are solid olors used in the olor map, followed
by the 32 olors (65 to 97) whi h make up the translu ent forms of the solid olors. These an be
set to one of several ranges with the Color form or the olor text ommand: red!green!blue,
red!white!blue, or bla k!white, et . There are no names for the spe i olors. The olor map
will be dis ussed in more detail in a se tion to follow.
Ea h olor has six properties whi h onsist of oating point values. Some des ribe the olor,
others the transparen y, and still others how the olor intera ts with the surrounding light. For the
most part, you will not need to alter the values given to these parameters by default. Alterations
will usually only arise when you want to tweak values to output rendering les used by VRML and
POV readers. Another appli ation of hanging the default olor settings might be de ning your
own olor palette or making bla k-and-white pi tures. The six options are:
 RGB: a triplet of numbers (0.0 to 1.0) des ribing the olor (red, green, blue); 0 indi ates none
of that olor (also see Di use).
 Alpha: a number (0.0 to 1.0) des ribing the transparen y; 1 is solid, 0 is transparent. By
default, transparent obje ts are drawn with alpha set to .3
 Ambient: a triplet of numbers (0.0 to 1.0) des ribing RGB values for the ambient light for
the given olor. Noti eable in absen e of di use light. Ambient light provides a uniform
illumination of obje ts with a ba kground lighting of the spe i ed olor. This means that if

73
you have ambient for the olor named ' yan' set to 1 0 0, the obje t olored in ' yan' will
appear red in the absen e of any light sour es and will have a red omponent in the 'shaded'
areas in the presen e of light sour es. Default is (0.0, 0.0, 0.0).
 Di use: same as RGB; This property determines the olor of the obje t. Di use re e tions
are independent of the viewing dire tion, but depend on the dire tion of the light sour e with
respe t to the surfa e of the displayed obje t.
 Spe ular: a triplet of numbers (0.0 to 1.0) des ribing the olor of spe ular re e tions. Pro-
du es highlights, the higher the value, the smaller and the brighter the highlight. Default is
(1.0, 1.0, 1.0). You an redu e the re e tivity of the surfa e by redu ing all three values (say,
to 0.5 0.5 0.5). This would give white light re e tions with less intensity. However, you an
use any settings to produ e e e t of a olored re e tion.
 Shininess: a number (1 to 100) des ribing how large is the angle of the spe ular re e tions.
The smaller the number the wider the angle and the more shiny obje ts appear. Default is
40.
For details regarding these material properties, onsult an elementary graphi s book su h as Foley
& Van Dam (Computer Graphi s).

6.1 Color ategories


VMD maintains a database of the olors used for the mole ules and the other graphi al obje ts in
the display window. The database onsists of several olor ategories; ea h olor ategory ontains
a list of names, and ea h name is assigned a olor. For example, there is a Resname olor ategory,
and within this ategory there are many names; one for ea h of the available residue names. Some
of these are ALA, CYS, and PRO. Ea h name an be assigned a olor from a list of 17 available olors
alled the olor map. The RGB value of ea h olor an be modi ed dire tly in the Color form
[x3.3.9℄. Also, ea h olor has a semi-transparent version used when the transparent button [x 3.3.4℄
is pressed in the Graphi s form. To olor items in a gradation manner, there are additional 32 olors
used in the olor s ale [x6.2.2℄.
The di erent olor ategories in VMD are listed in table 6.1. The Color form an be used to
hange the assignment of olors to the names in ea h of these ategories. For example, to hange
the olor used to draw Arginine residues when mole ules are olored by residue, you would use the
Color form, sele t the `Resname' ategory, sele t the `Arg' name there, and then pi k the olor to
use for Arginine's from the list of olors next to the names.

6.2 Coloring Methods


As des ribed in hapter 5, ea h representation for a mole ule has a spe i oloring method. The
oloring method determines how the olor for ea h atom in the representation (view) is determined.
These di erent methods use the olors assigned to the names in the ategories listed above, and use
those names to olor the atoms. Mole ular drawing methods whi h also draw the bonds between
atoms will always olor ea h half of the bond separately, using the olor of the nearest atom for
ea h half. Table 6.2 lists the di erent oloring methods available. The des ription for ea h method
explains the sour e of the information used to determine the olor.

74
Category Contents
Display The ba kground olor
Axes The omponents of the axes
Stage The olors for the he kboard stage
Name The available atom names ( olor by Name)
Type The available atom types ( olor by Type)
Resname The residue names ( olor by ResName)
Chain The one- hara ter hain identi er.
Segname The segment names ( olor by SegName)
Mole ule The names assigned to ea h mole ule ( olor by Mole ule)
Highlight The protein, nu lei , and non-ba kbone olors
Restype The residue types ( olor by ResType)
Stru ture The se ondary stru ture type (helix, sheet, oil) ( olor by Stru ture)
Labels The di erent labels (atoms, bonds, et .)
Table 6.1: Color ategories used in VMD.

6.2.1 Coloring by olor ategories


The default method is to olor by the atom name. The way it works is that there is a olor ategory
alled `Name' whi h ontains a list of all the atom names (e.g., CA, N, O5', and H) that have been
loaded into VMD. Ea h name is assigned one of the 16 main olors (e.g., yan, blue, red, and white).
When the drawing representation needs a olor for a spe i atom, it looks in the appropriate olor
ategory and nds that CA is olored yan, N is blue, and so on.
Most of the oloring methods are based on olor ategories, so oloring by `ResName' olors
ea h residue name di erently, `SegName' olors ea h segment di erently, and so on. The mapping
between a given item in a olor ategory and a olor an be hanged using the Color form [x3.3.9℄.
This allows users to make atoms with the name CA be bla k and the residue CYS be yellow.
Some attention was given to making the olors reasonable, so that oxygens are red, nitrogens blue,
sulphur and ysteines yellow, et .

6.2.2 Color s ale


Several of the oloring methods, in luding `Beta', `Charge', and `O upan y', des ribe a range of
oating point values rather than a set of names. These are olored via the olor s ale, whi h is a
list of 32 smoothly hanging olors. There are many olor gradations available. All of them onsist
of transformations of three olors. For instan e, \RGB" olors the smallest value red, values near
the middle of the s ale are green, and the largest values are blue. Colors in-between are linear
mixes of the two olors. The list of available gradations is given below.
The minimum of the range of values is linearly s aled and shifted to start at 0 and end at 1.
Assume the olor s ale is RGB. For a given value of x in the s ale range [0..1℄, the RGB value is
found rst from a linear s aling based on the midpoint. If x = 0, R is 1 (for maximum red). This
ontinues linearly until x = midpoint, at whi h point, R is 0 and stays 0. The green omponent is
0 at both x = 0 and x = 1 and is 1 at the midpoint. Linear s aling o urs in between. The blue
omponent is 0 for x <= midpoint, and 1 for x = 1.
An additional term, \min", is added to ea h of the omponent terms before they are merged.
This shifts the nal olors more towards white or bla k. Min an take on values from -1 to 1.

75
Method Des ription
Name Atom name, using the Name ategory
Type Atom type, using the Type ategory
ResName Residue name, using the Resname ategory
ResType Residue type, using the Restype ategory
ResID Residue identi er, using the resid mod 16 for the olor
SegName Segment name, using the Segname ategory
Mole ule Mole ule all one olor, using the Mole ule ategory
Stru ture Helix, sheet, and oils are olored di erently
Chain The one- hara ter hain identi er, using the Chain ategory
ColorID Use a user-spe i ed olor index (from 0 to 15)
Beta Color s ale based on beta value of the PDB le
O upan y Color s ale based on the o upan y eld of the PDB le
Mass Color s ale based on the atomi mass
Charge Color s ale based on the atomi harge
Pos Color s ale based on the distan e of ea h atom to the
enter of the mole ule. This is an interesting way to
view globular systems.
Index Color s ale is based on the atom index. Due to the way
the PDB le is organized, this a tually looks ni e.
Ba kbone Ba kbone atoms green, everything else is blue
Table 6.2: Mole ular oloring methods.

There is only one olor s ale used at a time so it is impossible to display obje ts olored by
multiple di erent olor s ales.

6.3 Transparen y
Making obje ts semi-transparent is a potentially powerful means of viewing multiple layers of the
mole ule simultaneously. Imagine a protein on the surfa e of, and extending part way into, a
membrane. One way to visualize the extent of the penetration is to represent the lipids as `Bonds'
and make them transparent. That will show the membrane without ompletely obstru ting the
view of the protein.
Transparen y is urrently not implemented in the OpenGL version of VMD. Thus, the following
suggestions apply only to versions of VMD ompiled with the GL option for IRIX5.x and IRIX6.x
platforms.
If transparent views of a mole ule seem to be obs uring other views, make sure all the trans-
parent views in the Graphi s form are farther down the list of views than non-transparent views.

Also, VMD will sometimes have problems displaying transparent obje ts when they are not
drawn in a front-to-ba k order. If you li k on the Transparent button on the Graphi s form and
rotate the mole ule around you will see instan es of this problem. VMD provides a s ript ommand
to orre t for this, but it tends to slow down the display update onsiderably. The ommand to
type into the onsole window is \display depthsort on". This will for e VMD to arrange the obje ts
in a front-to-ba k order by means of a depth sort. When many obje ts are on the s reen, this sort

76
Method Des ription
RGB small=red, middle=green, large=blue
BGR small=blue, middle=green, large=red
RWB small=red, middle=white, large=blue
BWR small=blue, middle=white, large=red
RWG small=red, middle=white, large=green
GWR small=green, middle=white, large=red
GWB small=green, middle=white, large=blue
BWG small=blue, middle=white, large=green
BlkW small=bla k, large=white
WBlk small=white, large=bla k
Table 6.3: Available Color S ale Gradations.

an result in a substantial amount of al ulation. Thus, it is best to rst rotate the view around
until you nd an angle and style that you are happy with, and then turn depth-sorting on to enable
orre t transparen y. The ommand to turn depth sorting o is simply \display depthsort o ."
The transparent olors hange their de nitions automati ally when the orresponding solid
olors are rede ned through the the Color form [x3.3.9℄. Using text interfa e, however, requires
hanging the settings for the transparent olors expli itly.

6.4 VMD S ript Commands for Colors


In order to ne tune olor parameters, one typi ally needs more sophisti ated ontrols than those
o ered in the GUI. For this reason, VMD provides a number of s ripting level ommands for olor
a ess. These ommands will be dis ussed in detail in hapter x10, but to give you a avor for their
use, here are a ouple of examples that you may nd useful right away. Most things an be done
with olor [x10.3.3℄ and olorinfo [x10.3.4℄ ommands.

6.4.1 Adjusting the degree of transparen y


To hange an obje t's transparen y value from the default of .3 to a smaller value of .1, one would
type the following T l s ript into the onsole, or write it to a text le and sour e it (see Using
text ommands [x10℄
pro hange_transparen y {new_alpha} {
# This will always get the orre t olors even if VMD
# gains new definitions in the future
set olor_start [ olorinfo num℄
set olor_end [expr $ olor_start * 2℄
# Go through the list of olors (by index) and
# hange their transp. value
for {set olor $ olor_start} {$ olor < $ olor_end} {in r olor} {
olor hange alpha $ olor $new_alpha
}
}

77
Figure 6.1: RGB olor s ale: the three plots shows the ontributions of ea h olor, and the resulting
olors are on the bottom.

# to use:
hange_transparen y .1

You an even make a new popup window to do this:


user add menu Transp
for {set i 0} {$i < 10} {in r i} {
set f [expr $i / 10.0℄
user add subitem Transp $f " hange_transparen y $f"
}

6.4.2 Changing the olor s ale de nitions


Suppose that of the 32 olors, the rst 15 should be red, then 2 whites, and nally 15 blues. You
an use the ` olor' ommand to modify the olor s ale values a ordingly. The only sti ky point is
that you must update the transparent de nitions as well or things might look strange.

78
Figure 6.2: The shift to the red omponent of the RGB s ale aused by the value of \min".

pro tri olor_s ale {} {


set olor_start [expr [ olorinfo num℄ * 2℄
for {set i 0} {$i < 32} {in r i} {
if {$i == 0} {
set r 1; set g 0; set b 0
}
if {$i == 15} {
set r 1; set g 1; set b 1
}
if {$i == 17} {
set r 0; set g 0; set b 1
}
olor hange rgb [expr $i + $ olor_start ℄ $r $g $b
# get the transparent version as well
olor hange rgb [expr $i + $ olor_start + 32℄ $r $g $b
}
}

tri olor_s ale

6.4.3 Creating a set of bla k-and-white olor de nitions


To map grays ale on the olor ids 0-16 (0=bla k; 16=white):
pro make_grays ale {} {
display update off
for {set i 0} {$i < 17} {in r i} {
set val [expr $i / 16.0℄
olor hange rgb $i $val $val $val
}
display update on
}
Note that the display updates are swit hed o for the time of rede nition, so that the s reen
would not be redrawn every time one olor is hanged. This way the pro edure works faster. The

79
only bad thing about this idea is that bla k be omes white, and white hanges too, so the names
of the olors (yellow, orange, et .) be ome useless.

6.4.4 Revert all RGB values to defaults


After some of the olor de nitions have been hanged and you want to restore the default de nitions,
the following pro edure might be useful.
pro revert_ olors {} {
display update off
forea h olor [ olorinfo olors℄ {
olor hange rgb $ olor
}
display update on
}

6.4.5 Setting the transparent olors a ording to solid


On e you have set the RGB values for solid olors, you may want to set the transparent olors to
the same RGB values. Here is how one ould do it:
pro set_trans_ olors {} {
set numof olors [ olorinfo num℄
for {set i 0} {$i < $numof olors} {in r i} {
lassign [ olorinfo rgb $i℄ r g b
olor hange rgb [expr $i + $numof olors℄ $r $g $b
}
}

6.4.6 Making the mole ule to show up slowly


The only appli ation of this that I know of is produ ing a movie for demonstration and having
parts of the mole ule appear and disappear slowly. These are very rude s ripts and they an be
improved.
# hange alpha values for all solid olors.
pro hange_alpha {newval} {
set num [ olorinfo num℄
for {set i 0} {$i < $num} {in r i} {
olor hange alpha $i $newval
}
}

# vary the alpha value from 0 to 1 thus for ing an obje t to slowly
# appear on the s reen.
pro fade_in {} {
for {set i 0} {$i < 1} {set i [expr $i + 0.05℄} {
hange_alpha $i
}
}

80
6.4.7 Querying VMD for Color Information
To obtain a list of the available olor names:
olorinfo olors
To obtain a listing of the attributes of the olor red:

forea h attrib {rgb alpha shininess ambient spe ular} {


puts "$attrib [ olorinfo $attrib red℄"
}
To hange the ambient value of the olor red to (1.0 .5 .33):
olor hange ambient red 1.0 .5 .33

81
Chapter 7

VMD Atom Sele tion Language


VMD has a rather powerful atom sele tion language available. It is based around the assumption
that every atom has a set of asso iated with it values whi h an be a essed through keywords.
These values ould be boolean (is this a protein atom?), numeri (as in the atom index or atomi
mass), or string (the atom name). The values an even be referen ed via a T l array.
To start o , here are some examples of valid sele tion ommands in VMD. Following these will
be a more in depth des ription of how sele tions work.

name CA
resid 35
name CA and resname ALA
ba kbone
not protein
protein (ba kbone or name H)
name 'A 1'
name 'A *'
name "C.*"
mass < 5
numbonds = 2
abs( harge) > 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 nu lei
same resname as (protein within 5 of nu lei )
protein sequen e "C..C"
name eq $atomname
protein and mysele tion

There are two types of sele tion modes. The rst is a keyword followed by a list of either values
or a range of values. For example,
name CA
sele ts all atoms with the name CA (whi h ould be a C or a al ium);

82
resname ALA PHE ASP
sele ts all atoms in either alanine, phenylalanine, or asparagine;
index 5
sele ts the 6th atom (in the internal VMD numbering s heme).
VMD an also do range sele tions, similar to X-PLOR's `:' notation:
mass 5 to 11.5
sele ts atoms with mass between 5 and 11.5 in lusive,
resname ALA to CYS TYR
sele ts atoms in alanine, arginine, asparagine, asparti a id, ystine, and also tyrosine.
The keyword sele tion works by he king ea h term on the list following the keyword. The term
is either a single word (eg, name CA) or a range (eg resid 35 to 90).
The method for determining the range he king is determined from the keyword data type;
numeri omparisons are di erent than string omparisons. The omparison should work as ex-
pe ted so that \8" is between \1" and \11" in a numeri ontext but not in a string one. This
may lead to some pe uliar problems. Some keywords, su h as segname, an take on string values
but an also be used by some people as a number eld. Suppose someone labeled the segname
eld with the numbers 1 through 12 on the assumption that they are numbers. That person would
be rather onfused to nd that segname 1 to 11 only returns two segments. Also, strings will be
onverted (via atof()) to a number so if the string isn't a number, it will be given the value of 0.
It is possible to for e a sear h to be done in either a string or numeri ontext using the relational
operator dis ussed in x7.6
Sele tions an be ombined with the boolean operators and and or, olle ted inside of paren-
thesis, and modi ed by not, as in
(name CA or name CB) and mass 12 to 17
whi h sele ts all atoms name CA or CB and have masses between 12 and 17 amu (this ould be used
to distinguish a C-alpha from a al ium). VMD has operator pre eden e similar to C so leaving
the parentheis out of the previous expression, as in:
name CA or name CB and mass 12 to 17
a tually sele ts all atoms named CA or those that are named CB and have the appropriate mass.

7.1 De nition of Keywords and Fun tions


The keywords available for sele ting atoms in VMD are listed in tables 7.1 and 7.2 at the end of
this hapter. If a keyword de nition is followed by bool, it is either on or o . If followed by str it
takes a value in the string ontext. If followed by num it takes a value in the number ontext.

83
Table 7.3 lists the built-in fun tions whi h may be used in atom sele tion expressions with
keywords whi h take on a numeri value.

7.2 Boolean Keywords


Some sele tions take no values. For example, ba kbone sele ts the ba kbone atoms of the protein
and nu lei a ids and protein sele ts protein atoms. Giving options to these sele tions is an error.
The sele tions an be used in the same way as other sele tions, as in:
protein and ba kbone
nu lei or protein
In addition, if neither and nor or are lo ated after a boolean keyword, then an impli it and is
inserted, so that the following are valid:
protein name CA (same as: protein and name CA)
nu lei ba kbone

7.3 Short Cir uiting


The boolean logi in VMD does short ir uit evaluation on an element-wise basis. For instan e,
given one atom, if X is true then X or Y will be true regradless of the value of Y, so there is no
need to evaluate it. Similarly, if X is false, then X and Y will also be false, so Y again need not be
evaluated.
Knowing how short ir uit sele tions work an speed up several types of sele tions. Consider a
system with a large number of waters and a protein. The expression protein and segname < 10
is faster than segname < 10 and protein sin e in the rst sele tion only the atoms whi h are
proteins have the segname onverted to a number, while in the se ond sele tion, all the segment
names are onverted.
The within sele tion has its own form of short ir uiting. The ommand an be interpreted as
\ nd the atoms of A whi h are withing a given distan e from B," and if A isn't given, sear h all
the atoms. The sear h done in VMD takes a time roughly proportional to the number of atoms
in A multiplied by the number of atoms in B, so redu ing the number of atoms in A (i.e., by not
testing every atoms) make the sear h faster.
Using the system with a lot of water and a protein, ompare the sele tion
protein within 5 of resid 1
to (within 5 of resid 1) and protein.
The rst is very fast as it does a distan e sear h between all the protein atoms and all the atoms
in resid 1. However, the se ond sele tion sear hes through all the atoms for those whi h are within
5A of resid and then nds whi h of those are protein atoms.

7.4 Quoting with Single Quotes


VMD allows two types of quoting me hanisms, single and double quotes. Single quotes are used
to in lude spa es and other non-alphanumeri hara ters. Believe it or not, there are some residue
names with a spa e in them, so they an be referen ed as, for example,

84
resname 'A 1'

More importantly, ribose atoms an be given names like C5' or C5* (depending on the age of
the PDB re ord). The lexer in VMD has been modi ed so that C5', O", and N'' an be used
without quotes, but it annot handle an unquoted asterisk (* on i ts with multipli ation and the
parser is not able to resolve the di eren e). Some examples are:
name 'O5*'
segname 'A *'
name O5'

Quotes may also be used to get around a reserved sele tion word, like x. The sele tion ommand
segname x will give an error be ause x is another keyword. Instead, use segname 'x'. There is an
es ape me hanism for in luding single quotes inside a single quoted string whi h uses a ba kslash
('\') before the single quote. This allows unusual names like C ' to be quoted as 'C \''.
segname x <---- error; onfli ts with the 'x' keyword
segname 'x'
name 'O5\''

Also, double quotes (dis ussed in the next se tion) an be used, as in "C '" or "C \*".

7.5 Double Quotes and Regular Expressions


Double quotes around a string are used to spe ify a regular expression sear h ( ompatible with
Perl 5.005, using the Perl- ompatible regular expressions library written by Philip Hazel). Regular
expressions are a very powerful on ept but rather hard to explain from s rat h. If you don't know
how to use them, you might have some lu k with the unix man pages for ed, egrep, vi, or regex.
If not, ask someone, or get any one of a number of books in luding the O'Reilly and Asso iates Sed
and Awk book. The following should given an idea of how they work.
Regular expressions allows sele tion of all atoms with a name starting with C as:
name "C.*"

or segment names ontaining a number as


segname ".*[0-9℄+.*"

As expe ted, multiple terms an still be provided on the list of mat hing keywords, as in
resname "A.*" GLY ".*T"

to sele t residues starting with an A, the gly ine residues, and residues ending with a T. Kind of
silly, but it is just to demonstrate. As with a string, a regular expression in a numeri ontext gets
onverted to an integer, whi h will always be zero.
In brief, a regular sele tion allows mat hing to multiple possibilities, instead of just one har-
a ter. Table 7.4 shows some of the methods that an be used.
So there are many ways to do some sele tions. For example, hoosing atoms with a name of
either CA or CB an be done in the following ways:

85
name CA CB
name "CA|CB"
name "C[AB℄"
name "C(A|B)"

Several aveats for those who already understand regular expressions. VMD automati ally
prepends \^(" and appends \)$" to the sele tion string. This makes the sele tion O mat h only
O and not OG or PRO. On the other hand, putting ^ and $ into the ommand won't really a e t
anything, sele tions that mat h on a substring must be pre eded and followed by \.*", as in .*O.*,
and some illegal sele tions ould be a epted as orre t, but strange, as in C)|(O , whi h gets
onverted to ^(C)|(O)$ and mat hes anything starting with a C or ending with an O.
A regular expression is similar to wild ard mat hing in X-PLOR. Table 7.5 is a list of onversions
from X-PLOR style wild ards to the mat hing regular expression.

7.6 Comparison sele tions


Comparisons an be used in VMD to do atom sele tions like mass < 5, whi h sele ts atoms with
mass less than 5 amu, and name eq CA, whi h is another way of hoosing the CA atoms. The
underlying idea for the omparison sele tion is also based on the on ept that every atom has a
property as spe i ed by a keyword. When the keyword is given in the expression, the array (or
ve tor) of the orresponding values is onstru ted, and the size of the array is the same as the
number of atoms in the mole ule. (If a single number or string is given instead of a keyword, the
array onsists of opies of that given value.) The operations, like addition, multipli ation, string
mat hing, and omparison, are then applied element-wise along the array. This type of sele tion is
similar to the ve tor statement in X-PLOR.
Take the example mass < 5 when applied on water, whi h has an oxygen of mass 15.9994 and
two hydrogens of mass 1.008. VMD sees the keyword mass and onstru ts the array [15.9994,
1.008, 1.008℄, then sees the \5" and makes the array [5, 5, 5℄. It then ompares ea h term of the
array and returns with the boolean array [False, True, True℄ (sin e 15.9994 is not less than 5, but
1.008 is). This nal boolean array is then used to determine whi h atoms are sele ted; in this ase,
the hydrogens.
More ompli ated omparison sele tions an be onstru ted, either from arithmeti operations
or by using some of the standard math fun tions (the fun tions are listed in Table 7.3). Probably
the most often used fun tion will be sqr, whi h squares ea h element of the array. Thus, the
ommand to sele t all atoms within 5  A of a point (x,y,z) = (3,4,-5) in spa e is:

sqr(x-3)+sqr(y-4)+sqr(z+5) <= sqr(5)

7.7 Comparison Operators


There are two types of omparison operators | numeri and string | whi h allow the user to
spe ify the appropriate omparison fun tion. Suppose the segment name, whi h takes on a string
value, ontains the names `11', and `8'. VMD annot gure out if `8' should be less than `11' (in
the numeri sense) or greater than `11' (in the lexographi al sense). Instead of trying to resolve
this problem through some sort of internal heuristi s, VMD leaves it up to the user so that 8 < 11
but 11 lt 8. (Perl users should re ognize this solution.)

86
The numeri omparisons are the standard ones: <, <=, = or ==, >=, >, and !=. The orresponding
string omparisons are: lt, le, eq, ge, gt, and ne. As in perl there is a \mat h" operator, =~, so
that
'CA' =~ "C.*"
segname =~ "VP[1-4℄" (mat hes VP1, VP2, VP3, and VP4, present in some
virus stru tures)

are valid. No distin tion is made between single and double quotes.

7.8 Other sele tions


7.8.1 sequen e
VMD supports sele tion based on the one-letter amino a id sequen e with the sequen e sele tion
keyword. This allows sele tions of the form
sequen e APD
sequen e "C..C" (might be used to pi k out zin fingers)
sequen e AATCGGAT
Unlike the other string sele tion ommands whi h take one of three types of strings, all the
strings for sequen e are taken as regular expressions (though strings with non-alphanumeri s must
still be quoted to get past the input parser). The method works by taking ea h of the protein
and nu lei a id fragments (pfrag and nfrag) in turn and onstru ting the one-letter amino a id
sequen e. If a regular expression mat hes any of the sequen e, the atoms in the mat hing residues
are sele ted. Multiple mat hes are allowed, though they annot overlap. As is usual with regular
expressions, the largest possible mat h is made, so take are with expressions like C.*C.

7.8.2 within and same


Two useful types of sele tion me hanisms available in VMDare: within <number> of <sele tion>
and same <keyword> as <sele tion>. The rst sele ts all atoms within the spe i ed distan e (in

A) from a sele tion, in luding the sele tion itself. Therefore, the ommand:
within 5 of name FE

sele ts all atoms within 5 


A of atoms named FE. One ommon use for this ommand is to limit the
region of atoms shown on the s reen. Another is to nd atoms that may be involved in intera tions.
For instan e:
protein within 5 of nu lei

nds the protein atoms that are nearby nu lei a ids. On a autionary note, the distan e sear h
method is not very eÆ ient, making these sele tions rather slow. Some sele tions may be sped up
by short ir uiting [x7.3℄.
The same <keyword> as <sele tion> nds all the atoms whi h have the same `keyword' as
the atoms in the sele tion. This an be used for sele tions like
same fragment as resid 35

87
whi h nds all the atoms atta hed to residue id 35. Any keyword an be used, so sele tions like
same resname as (protein within 5 of nu lei )
are ne, although weird. The perhaps the most useful keyword for this ommand is residue, so
you an say same residue as ....

7.9 Referen ing T l data


T l variables (with either s alar or array data) an be used in the sele tion in one of two possible
ways.

7.9.1 $referen es
If a keyword starts with a $, the rest of the keyword is used as the T l variable name. The T l
interpreter is queried for the asso iated data, whi h is then used as it would be for any other
keyword. The variable an be either an array, in whi h ase element 0 is for the rst atom, 1 for
the se ond, . . . ; or a s alar value, in whi h ase that value is used for all the atoms. For an array
example, suppose the T l array \foo" ontained the values foo(n) = 2*n. Then the statement $foo
< 10 sele ts atom with indi es 0 to 4, while $foo 20 to 30 6 sele ts indi es 10, 11, 12, 13, 14, 15,
and 3. If foo has a s alar value, su h as PRO, the statement resname eq $foo sele ts the proline
residues. Be ause of a limitation in T l, the only way VMD re ognizes if a variable is an array is
if element 0 exists.

7.9.2 referen es
The other way to referen e a T l variable is as a boolean array. This is most often used when there
is a set of atoms whi h must be referen ed often or when the sele tion is very ompli ated. These
start with a  sign and spe ify if the given atom should be on or o . This notation is used in the
same pla e as a boolean keyword (like protein or water). As with the $ variables, the T l variable
an be either a s alar or an array. If the value is false, (or 0) the orresponding atom is not sele ted.
If true (or non-zero), it is turned on. Additionally, if the s alar value is an atom sele tion, the data
from that sele tion is used. Here are some examples of variables:
if the array foo(n) is de ned as 1 of n is odd, 0 if n is even, then the sele tion text foo turns
on atoms with an odd numbered atom index.
Let \my sele tion" be de ned as set my sele tion [atomsele t top resid 35℄ then the sele tions
\$my sele tion and name CA" and \side hain $my sele tion" are also valid.

7.9.3 The di eren es


The di eren e between the two notations ($ and ) is somewhat subtle and o urs be ause the
original sele tion language is not as dynami as one would expe t. The key thing to remember
about T l referen es is they are used only where keywords are allowed. $variables are for keywords
that have a value while variables are for boolean keywords. That means variable referen es annot
be in the parameter list for the value keywords (e.g., resname $name is not allowed). Instead, the
omparison operators must be used (as in resname eq $name).

88
Keyword Arg Des ription
all bool everything
none bool nothing
name str atom name
type str atom type
index num the atom number, starting at 0
hain str the one- hara ter hain identi er
residue num a set of onne ted atoms with the same residue number
protein bool a residue with atoms named C, N, CA, and O
nu lei bool a residue with atoms named P, O1P, O2P and either
O3', C3', C4', C5', O5' or O3*, C3*, C4*, C5*, O5*.
This de nition assumes that the base is phosphorylated,
an assumption whi h will be orre ted in the future.
ba kbone bool the C, N, CA, and O atoms of a protein
and the equivalent atoms in a nu lei a id.
side hain bool non-ba kbone atoms and bonds
water, wa- bool all atoms with the resname H2O, HH0, OHH, HOH,
ters
OH2, SOL, WAT, TIP, TIP2, TIP3 or TIP4
fragment num a set of onne ted residues
pfrag num a set of onne ted protein residues
nfrag num a set of onne ted nu lei residues
sequen e str a sequen e given by one letter names
numbonds num number of bonds
resname str residue name
resid num residue id
segname str segment name
x, y, z num x, y, or z oordinates
radius num atomi radius
mass num atomi mass
harge num atomi harge
beta num temperature fa tor
o upan y num o upan y
at bool residues named ADA A THY T
a idi bool residues named ASP GLU
a y li bool \protein and not y li "
aliphati bool residues named ALA GLY ILE LEU VAL
alpha bool atom's residue is an alpha helix
amino bool a residue with atoms named C, N, CA, and O
aromati bool residues named HIS PHE TRP TYR
basi bool residues named ARG HIS LYS
bonded bool atoms for whi h numbonds>0
buried bool residues named ALA LEU VAL ILE PHE CYS MET TRP
g bool residues named CYT C GUA G
harged bool \basi or a idi "
y li bool residues named HIS PHE PRO TRP TYR
Table 7.1: Atom sele tion keywords.
89
Keyword Arg Des ription
hetero bool \not (protein or nu lei )"
hydrogen bool name "[0-9℄?H.*"
large bool \protein and not (small or medium)"
medium bool residues named VAL THR ASP ASN PRO CYS ASX PCA HYP
neutral bool residues named VAL PHE GLN TYR HIS CYS MET TRP ASX GLX PCA HYP
polar bool \protein and not hydrophobi "
purine bool residues named ADE A GUA G
pyrimidine bool residues named CYT C THY T URI U
small bool residues named ALA GLY SER
surfa e bool \protein and not buried"
helix bool atom's residue is an alpha helix
helix 3 10 bool atom's residue is an alpha helix
extended beta bool atom's residue is a beta sheet
bridge beta bool atom's residue is a beta sheet
rasmol Rasmol translates Rasmol sele tion syntax to VMD
string
alpha helix bool atom's residue is an alpha helix
pi helix bool atom's residue is a pi helix
helix bool atom's residue is an alpha or pi helix
sheet bool atom's residue is a beta sheet ???
turn bool atom's residue is in a turn onformation
oil bool atom's residue is in a oil onformation
stru ture str single letter name for the se ondary stru ture
within str sele ts all atoms within a spe i ed distan e
of a sele tion (i.e within 5 of name FE).
same str sele ts all atoms whi h have the same keyword
as the atoms in a given sele tion (i.e. same segname as resid 35)
ux, uy, uz num for e to apply in the x, y, or z oordinates
Table 7.2: Atom sele tion keywords ( ontinued).

90
Fun tion Des ription
sqr(x) square of x
sqrt(x) square root of x
abs(x) absolute value of x
oor(x) largest integer not greater than x
eil(x) smallest integer not greater than x
sin(x) sine of x
os(x) osine of x
tan(x) tangent of x
atan(x) ar tangent of x
asin(x) ar sin of x
a os(x) ar os of x
sinh(x) hyperboli sine of x
osh(x) hyperboli osine of x
tanh(x) hyperboli tangent of x
exp(x) \e to the power x"
log(x) natural log of x
log10(x) log base 10 of x
Table 7.3: Atom sele tion fun tions.

Symbol Example De nition


. . , A.C mat h any hara ter
[℄ [ABCab ℄ , [A-Ca- ℄ mat h any har in the list
[~℄ [~Z℄ , [~XYZ℄ , [^x-z℄ mat h all ex ept the hars in the list
^ ^C , ^A.* next token must be the rst part of string
$ [CO℄G$ prev token must be the last part of string
* C* , [ab℄* mat h 0 or more opies of prev har or
regular expression token
+ C+ , [ab℄+ mat h 1 or more opies of the prev token
\| C\|O mat h either the 1st token or the 2nd
\(\) \(CA\)+ ombines multiple tokens into one
Table 7.4: Regular expression methods.

X-PLOR Wild ard Des ription Regular Expression


* mat hes any string .*
% mat hes a single hara ter .
+ mat hes any digit [0-9℄
# mat hes any number [0-9℄+
Table 7.5: Regular expression onversions.

91
Chapter 8

Creating Output Raster Images


VMD urrently has no provision for making a raster image le (like a GIF, TIFF, or RGB) dire tly,
other than using an external program to do a s reen apture. In many ases it is suÆ ient to use
the SGI program snapshot to get the image from the s reen. This saves the image to an RGB
le whi h an then be onverted to other formats with the programs /usr/sbin/to* (e.g., togif
onverts RGB les to GIF). Sin e RGB is the default SGI image format, many other programs an
be used to view, edit, and manipulate RGB les.
To use snapshot in this sense, simply open the Render form [x3.3.10[ and hoose the snapshot
option. VMD will automati ally pass the window oordinates to this program and the apture will
take pla e and the resulting RGB le will be posted to the display. After a little pra ti e with
this option, you will re ognize that it is important not to have other windows in front of the VMD
display when doing this type of apture, sin e snapshot will then in lude part of these windows in
the output RGB pi ture.
The snapshot rendering option is presently not available to those using the HP or Linux version
of VMD
Sometimes the s reen image isn't good enough; you may want a very large, high quality pi ture,
or maybe a pi ture with shadows. Instead of making these images dire tly, VMD writes les whi h
an be used as input to several of the more popular ray shading programs. Table 8.1 lists the
urrently supported output formats, and, if appli able, where they may be obtained.

8.1 Creating an Output Image File


Making the raster image is a two step pro ess. First you must make the output le suitable for the
image pro essing program, and then exe ute the program using the new le as input to produ e
the raster output. The problem is that ea h of the programs write a di erent output le format,
whi h will probably have to be onverted to something more appropriate for you. It is impossible
to predi t what that might be, so we'll say how to onvert the di erent le types to RGB and let
you use the tools listed in Table 8.1 to get what you need. Raster3D produ es an RGB le, so you
don't need to do anything. POV and POV3 produ e TARGA les, whi h an be onverted on SGI
ma hines with the program /usr/sbin/fromtarga. Rayshade reates RLE image les, whi h an
be onverted on SGI ma hines with /usr/sbin/fromutah. Radian e generates an .o t le, whi h
an be onverted with the rview and rpi t ommands in the Radian e distribution.
The free program display from ImageMagi k { see
http://www.wizards.dupont. om/ risty/ImageMagi k.html {

92
Name Des ription Default Render Command
Raster3D1 Fast raster le generator render < %s -sgi %s.rgb; ipaste %s.rgb
tkRaster3D2 Tk interfa e to Raster3D render < %s -sgi %s.rgb; ipaste %s.rgb
POV33 POV-Ray 3.0 ray tra er povray3 +H500 +W400 -I%s -O%s.tga +D +X +A
+FT +C
POV3 POV-Ray ray tra er povray +H250 +W200 -I%s -O%s.tga +P +X +A
+FT
Rayshade4 Rayshade ray tra er rayshade < %s > %s.rle
Radian e5 Radiosity ray tra er o onv %s > %s.o t; rview -pe 100 -vp -3.5 0
0 -vd 1 0 0 %s.o t
ART6 VORT ray tra er render < %s -sgi %s.rgb; ipaste %s.rgb
PostS ript Dire t PostS ript Output ghostview %s &
STL Stereolithography Format true - Renders Triangles Only
VRML-1 Virtual Reality Markup true - view this with VRML viewers like webspa e
Language
Token Text Dump of Graphi al true
Obje ts
1 See http://www-bio.unizh. h/visualization/raster3d/raster3d.html for more info.
2 Conta t ???
3 See http://www.povray.org/ for more info.
4 See http://www-graphi s.stanford.edu/ ek/rayshade/rayshade.html for more info.
5 See http://radsite.lbl.gov/radian e/HOME.html for Radian e
6 Available from ftp://gondwana.e r.mu.oz.au/pub along with the rest of VORT pa kage
7 See http://vrml.sgi. om/intro.html

Table 8.1: Supported output rendering formats.

should be able to read and inter onvert all of these formats.


We suggest using either Raster3D or Radian e as they are the fastest of the programs. The
rst is the easiest to understand and the se ond has many, many options (di erent types of lights,
textures, . . . ).
The image pro essing program input formats are straight text so they are easy to modify. This
is most often done to reate a larger raster le, though some have other global options whi h you
may wish to hange. For instan e, by default the Raster3D le turns shadows on. We suggest you
onsult the relevant do umentation to determine what an be modi ed in the le.
To a tually render the urrent image into an output le, rst set up the graphi s in VMD just
as you wish the output to appear. Then, either use the Render form [x 3.3.10℄, or the following
text ommand, to reate the input le and start the rendering program going:
 render method lename [render ommand℄
method is one of the names listed in the rst olumn of table 8.1, and lename is the name of the
le whi h will ontain the resulting image pro essing program s ript. Any text following this will
be used as a ommand to be run to pro ess the le. If %s appear in the ommand string, they will
be repla ed with the name of the s ript le.

93
8.2 Known Problems
When VMD reates the output le it will try to mat h the urrent view and s reen size. For the
most part it does a good a job but there are some problems. The olors in the nal raster image
seem to be faded when ompared to the s reen. We may be able to orre t this in future versions
by arti ially in reasing the olor intensity. In the meantime, this an be remedied with a program
like xv or display whi h will brighten and sharpen the image.
The eye position seems to be slightly di erent between the s reen and raster images. This
o urs be ause the S reen Height and S reen Width (see x3.3.8) values are not propagated to the
output le, so the programs have slightly di erent transformation matri es. We have added an
extra s aling fa tor, determined by trial and error, whi h redu es this e e t for the default s reen
sizes, but the fa tor is only valid if the parameters are not hanged.
The lights are supposed to be positioned in the output le as they are on the s reen but not
all formats support the number of lights available in VMD. In addition, there seems to be a bug
in the ode that determines the orre t light positions. This an be hanged by editing the output
le by hand.
A new option in VMD draws ylinders with at disks overing the ends. Some of the renderers
may not draw the apped ends.
We have primarily tested the Raster3D output and have little experien e with the other pro-
grams. The only problem we have found with Raster3D is if there are too many obje ts to render
(this ould easily o ur when using `Tube' or `Ribbon' on large mole ules), it will not render any-
thing. (Raster3D do umentation mentions an \obje t limit"|Raster3D an be re ompiled with a
new limit.)

8.3 One Step Printing


A frequently asked question is \How an I qui kly get a printout of the VMD Display?" There are
several one step solutions to this problem
 Choose the PostS ript output option in the Render form and type lpr %s in the render
ommand box.
 Choose the snapshot option and type onvert %s eps:%s.ps; lpr %s.ps in the render
ommand box. This assumes that you have the ImageMagi k tools available in your PATH
setting.
 As an example of how to dire tly print a Raster3D le, hoose the Raster3D option in the Ren-
der form and type render < %s -sgi %s.rgb; onvert %s.rgb eps:%s.ps; lpr %s.ps in
the render ommand box.

94
Chapter 9

Viewing Modes
There are many di erent viewing modes available. These show the s ene in orthographi or per-
spe tive views, and in several mono- and stereo- graphi displays. The stereo mode an be hanged
using the popup menu available from the graphi s display window. It an also be hanged by using
the stereo entry in the Display form or the text ommand display stereo mode.

9.1 Perspe tive/Orthographi views


In the perspe tive view (the default), obje ts whi h are far away are smaller than those nearby.
In the orthographi view, all obje ts appear at the same s ale. Sin e some prefer one over the
other, both options are available. Perspe tive viewpoints give more information about depth and
are often easier to view be ause you use perspe tive views in real life. Orthographi viewpoints
make it mu h easier to ompare two parts of the mole ule, as there is no question about how the
viewpoint may a e t the per eption of distan e.

9.2 Monos opi Modes


When you normally look at obje ts, your two eyes see slightly di erent images (be ause they are
lo ated at di erent viewpoints). Your brain puts the images together to generate a stereos opi
viewpoint. When generating a single image for the omputer display, the default al ulations (mode
Stereo O ) assume there is one eye entered between where two eyes would be. Sometimes, as when
generating ray tra ing input les, the left and right eye views need to be generated independently.
Choosing mode Left produ es the left eye viewpoint, while Right produ es the right eye viewpoint.

9.3 Stereos opi Modes


Mole ules may be rendered in stereo, whi h an greatly enhan e the appearan e and visual ontent
of the displayed systems. There are several stereo formats available:
1. Side-by-side ross-eyed stereo;
2. Side-by-side wall-eyed stereo;
3. Crystal Eyes stereo (requires stereo- apable monitor, stereo syn emitters and spe ial stereo
glasses equipped with liquid rystal lenses).

95
9.3.1 Side-By-Side and Cross-Eyed Stereo
Side-by-side stereo means that the normal display is divided into two halves, a left view and a
right view, ea h o upying one-half of the original display area. Ea h view displays the urrent
mole ules from a slightly di erent perspe tive, orresponding to the left and right eye of the viewer.
The images are separated, however, so to a tually see a 3D obje t you must dire t your eyes until
the two images are on top of ea h other, and then fo us on the resulting image until you an see it
as three-dimensional.
There are two ways of pla ing the images. In wall-eyed stereo, the left eye's image is lo ated on
the left side of the display, and the right eye's image is on the right. This is the standard method
for displaying stereo images in publi ations as it works well when the display (in this ase, the pie e
of paper) is lose to the eyes. It is alled wall-eyed be ause your eyes are dire ted the same way
they would be if looking at a distant wall. In VMD, this method is referred to as \SideBySide"
stereo.
In ross-eyed stereo, the left eye's image is lo ated on the right side of the display, and the right
eye's image is on the left, and hen e the name ross-eyed. This is mostly used for distant displays
(su h as overhead proje tions) as it is mu h easier to ross eyes at that range than use the wall-eyed
method { you are already looking at the wall. In VMD, this method is referred to as \CrossEyes"
stereo.

9.3.2 Crystal Eyes Stereo


Crystal Eyes stereo refers to a spe ial hardware option available on Sili on Graphi s workstations
that allows one to view three-dimensional obje ts through the use of a spe ial display monitor
mode and spe ial stereo viewing glasses. Stereographi s Corp. is one su h supplier of these glasses.
This mode also requires spe ial infrared emitters to syn hronize the stereo glasses with the display
monitor.
There are presently two types of Crystal Eyes stereo modes available on SGI ma hines; whi h
one is used depends on the available graphi s hardware (see the man page stereo(7)). Follow the
outline below for the relevant graphi s option:

Stereo in a window (aka new-style stereo): Available on workstations equipped with Reality
Engine2-style graphi s subsystems only (su h as Onyx or Power Onyx ma hines), this mode provides
separate left and right eye frame bu ers. It allows the user to have a window display in stereo, and
the other windows appear as normal. Using this mode, however, requires the monitor to be in a
lower-resolution 960 by 680 display mode. The monitor must be set in this mode before starting
VMD. To do so, do one of the following:
 If superuser a ess is not available, and the monitor is in the normal 1280x1024 mode, exe ute
the ommand:

/usr/gfx/setmon -n 960x680 108s

This will hange the display hara teristi s to the lower resolution mode, with a higher display
frequen y (108 Hz), but will not hange the managed size of the X-Window display s reen.
To hange ba k to the normal mode (after running VMD), exe ute the ommand:

/usr/gfx/setmon -n 1280x1024 60

96
When the omputer is in the lower resolution mode, run VMD as normal, but note that the
lower resolution means the windows will appear larger and may end up sometimes positioned
o -s reen. If this is a problem, a system superuser should set the video mode permanently
with the ommands listed in the next item.
 If superuser a ess is available, do the following, whi h will hange the video mode and restart
the window server with the lower resolution settings. (WARNING: exe uting this ommand
will log out anyone on the onsole)

/usr/gfx/setmon -x 960x680 108s; /usr/gfx/stopgfx; /usr/gfx/startgfx &

To reset the omputer to regular 1280x1024 use, exe ute the ommand:

/usr/gfx/setmon -x 1280x1024 60; /usr/gfx/stopgfx; /usr/gfx/startgfx &

It may be useful, if stereo-in-a-window will be used often, to set the monitor to the lower
resolution mode, and leave it that way.
On e set in the proper display mode, start VMD as normal, and sele t `Crystal Eyes stereo' from
the display window pop-up menu. The image should swit h to two images nearly superimposed,
but slightly o set.

Regular stereo mode: All stereo-equipped SGI workstations an use this display mode, in lud-
ing Reality Engine 2 workstations. VMD uses two programs onstereo and offstereo to swit h the
monitor display mode. You will need to install these programs somewhere in your Unix path in order
to allow VMD to use them. Regular stereo mode will hange the display window to o upy the en-
tire monitor s reen, as opposed to stereo-in-a-window whi h an independently set the stereo mode
of just the display window. Versions of onstereo and offstereo whi h will run on SGI IRIX 5.X
workstations may be obtained via anonymous ftp from ftp://ftp.ks.uiu .edu/pub/mds ope/vmd.

9.3.3 Problems with stereo on Indigo2 ma hines


SGI ma hines running versions 5.X or early versions of 6.X of IRIX may require pat hes for their
OS in order to run rystal eyes stereo.

9.3.4 Stereo Parameters


A stereo image is generated by drawing two images from two di erent perspe tives, one from the
left eye and one from the right. The images are made by nding the view that would be seen
by someone lo ated inside the s ene. The method uses two parameters to nd the view; the eye
separation and the fo al length. The rst de nes the distan e between the eyes and gives the
parallax e e t. Setting the separation to 0 will result in a at 2D image, while setting it too large
will give most people a heada he.
The graphi s model used by VMD assumes the eyes looking in front of the viewer and fo using
at the same point the fo al length away. If the fo al length is 0, the viewer's eyes are rossed and
looking at ea h other. A larger fo al length will often help in reating a viewable image.
The two parameters an be hanged with the text ommands display fo allength and
display eyesep, or using the Display form [x3.3.8℄.

97
In general, try to make the eye separation as large as possible without giving the viewer a
migrane, and try to vary the fo al length to ut down on double images. It may often help to
translate the mole ule forward or ba kward and also adjust the s aling, sin e there is typi ally an
optimum position for a mole ule for a given set of stereo parameters.

9.4 Making Stereo Raster Images


As dis ussed in Chapter x8, VMD an reate output les of the urrent s ene in the format needed
for input by various image pro essing pa kages. These formats do not always natively support the
ability to draw stereo images. In prin iple, it is possible to write the s ene to the le twi e with the
appropriate transformations applied to make the view orre t for ea h eye, but then the shadows
would be in orre t.
Instead, we suggest making one image of the urrent s ene, then shift the mole ules to the left
(or right) to make the other image. (Note that neither the stage nor the axes will move, so they
will not be in stereo.) The text ommands for this are something like:
render Raster3D left.r3d
trans by -.1 0 0
render Raster3D right.r3d
The two les must then be rendered to produ e the rgb le. As it turns out, this method makes
it easy to produ e stereo images of ordinary Raster3D les. Sin e VMD an read the Raster3D
format, all you have to do is read the le and then exe ute the ommands listed above. The text
ommands for generating left or right views also have equivalents in the GUI under the Stereo
option of the Display form.

98
Chapter 10

Text User Interfa e


The text interfa e provides omplete a ess to all the VMD ommands. In its basi form it an
be used to load mole ules, rotate them, add and alter representations, and anything else that an
be done with the Forms and mouse interfa e. The standard distribution is ompiled with T l and
the T lX and T l-DP extensions, whi h add a omplete s ripting language in luding variables,
loops, and onditionals along with a standard method for ommuni ating with other programs
via standard TCP/IP so kets. Versions 1.2 and later also in lude the Tk toolkit and the TkX
extension. This allows, for example, to qui kly reate a form with buttons bound to one's favorite
a tions (similar to popup menus, but mu h more exible).
This se tion des ribes the basi s of the text interfa e as well as the ore VMD ommands. A
few of the T l ommands are mentioned here, but are so noted.

10.1 Using text ommands


Text ommands are entered by typing them at the VMD prompt in the text onsole window.
This window normally ontains the prompt vmd > . When other text (e.g., from a mouse pi k)
is displayed to the s reen, it will s roll the s reen up so the prompt is not at the last line of the
s reen. To make it reappear, press enter. When entering multi-line ommands, an alternate prompt
appears, ? , and will not disappear until the ommand is nished. Sometimes it is waiting for a
lose to a double quote, open bra e, or open bra ket, while at other times it is waiting for a line
that doesn't end in a ba kslash. Please read a T l manual to better understand what onstitutes
the end of a statement.
Sin e you may not want to retype all the data in every time, there are two ways to read the
data in from a text le. The preferred method is the play VMD ore ommand. This reads a line
from the le, exe utes it, then updates the s reen and he ks for any hanges in the mouse or forms
input. Using this ommand you an modify the display options while the s ript is being read. The
other option uses the T l ommand sour e. This reads the whole le before allowing the mouse
and forms to respond to new input.
There are two other ways to play a le. If the le .vmdr (see se tion x17.3.4) exists during
startup, it is played. Similarly, at startup the -e ommand line ag an be used to spe ify an input
le.

99
10.2 T l/Tk
T l (short for Tool Command Language, developed by John Ousterhout) is an embeddable and
extensible s ripting language. In other words, T l sits inside VMD as a language interpreter where
it an exe ute its standard language ommands or the various VMD spe i extensions. There are
several reasons for using T l rather than writing our own language, the most important being that
it is easy to use, it was easy to modify our ode to use it, it has few bugs, and do umentation is
available at many bookstores. Many other pa kages use it, in luding Quanta. It is not ne essary
that you know T l to use VMD. However, it is useful for some o asions, like making movies or
s ripts.
VMD uses T l version 7.6 and Tk version 4.2. Sin e T l is extensible, many extension pa k-
ages have been written to improves urrent features and add new ones. We have in luded two
of these, T lX (version 7.6), whi h adds many useful ommand for s ript writing, and T l-DP
(version 4.0), whi h adds an interfa e to Unix so ket ommands. This latter extension is used
by the External interfa es [x3.4.1℄. The TkX version 4.2.0 is also in luded. We refer you to
http://www.s ripti s. om/ for more information about T l, and
http://www.s o. om/Te hnology/t l/T l.html for referen es to do umentation on T l/Tk and
T lX. For the do umentation on T l-DP see the T l-DP home page at
http://www. s. ornell.edu/Info/Proje ts/zeno/Proje ts/T l-DP.html.

10.3 Core Text Commands


Most of VMD was originally written without the T l interfa e. The text interpreter used (whi h is
still available as a ompile time option) treated the ommands in a slightly di erent form than T l
does. Be ause we did not rewrite the old ommands when T l was added, there are slight di eren es
in usage between the old style interfa e (the \ ore" ommands) and the new T l fun tions. For the
most part, these are subtle and not important. For more information see the se tion on \writing
s ripts."
All text ommands in VMD are omposed of one or more words or phrases separated by white
spa e, and terminated by a newline. Sin e the parser now uses T l, a \phrase" is text surrounded
by double quotes or by a mat hing set of open and lose bra es. (Please read the T l manual
to better understand what onstitutes the end of a statement.) The rst word of ea h ommand
indi ates the general purpose for the ommand, and the following words spe ify the exa t type of
ommand to exe ute. Table 10.1 summarizes the text ommands in VMD by listing the rst words,
and des ribing the general purpose for ommands starting with those words. Sin e VMD an be
ompiled with optionally in luded omponents and features, ommands labeled optional may not
be available in your version of VMD.
The ommands des ribed in the following se tions are listed by name, and followed by a list of
the available arguments. If an argument is optional, it is en losed in [℄s. If only one of a list of
arguments is needed, the list is en losed in <>s and the items are separated by |. Words in itali s
indi ate a string or value to be spe i ed by the user.

10.3.1 animate
These ommands ontrol the animation of a mole ular traje tory and are used to read and write
animation frames to/from a le or Play/Pause/Rewind a mole ular traje tory.

100
First Word Des ription
animate Play/Pause/Rewind a mole ular traje tory.
axes Position a set of XYZ axes on the s reen.
olor Change the olor assigned to mole ules, or edit the olormap.
olorinfo (T l) Obtain olor properties for various obje ts
debug Turn on/o printing of debugging messages.
display Change various aspe ts of the graphi al display window.
e ho Turn on/o e hoing of text ommands to the onsole.
exit, quit Quit VMD.
external (T l) Start an external VMD ommand sour e (optional).
help Display an on-line help le with an HTML viewer.
imd Control the onne tion to a remote simulation.
log le Turn on/o logging a VMD session to a log le.
label Turn on/o labels for atoms, bonds, angles, or dihedral angles.
light Control the light sour es used to illuminate graphi al obje ts.
menu Control or query the on-s reen GUI menu forms.
mole ule or mol Load, modify, or delete a mole ule in VMD.
mouse Change the urrent state (mode) of the mouse.
play or run Start exe uting text ommands from a spe i ed le.
render Output the urrently displayed image (s ene) to a le.
ro k Rotate the urrent s ene ontinually at a spe i ed rate.
rotate Rotate the urrent s ene around a given axis by a ertain angle.
s ale S ale the urrent s ene up or down.
stage Position a he kerboard stage on the s reen.
tool Initialize and ontrol external spatial tra king devi es.
translate Translate the obje ts in the urrent s ene.
user Add new ommands to the graphi s display pop-up menu.
vmdinfo (T l) Get information about this version of VMD
wait Wait a number of se onds before reading another ommand. Animation ontinues.
sleep Sleep a number of se onds before reading another ommand. Animation is frozen.
Table 10.1: Summary of ore text ommands in VMD.

 dup [ frame number ℄ molId: Dupli ate the given frame (default \now") of mole ule molId
and add the new frame to this mole ule.
 forward: Play animation forward.
 for: Same as forward.
 reverse: Play animation ba kward.
 rev: Same as reverse.
 pause: Pause animation.
 prev: Go to previous frame.
 next: Go to next frame.

101
 skip n: Set stride to n+1 frames.
 delete all: Delete all frames from memory.
 speed n: Set animation speed to n.
 style on e: Set to play animation on e.
 style loop: Set to loop through animation ontinuously.
 style ro k: Set to play animation forward and ba k ontinuously.
 styles: Return a list of the available styles.
 goto start: Go to rst frame.
 goto end: Go to last frame.
 goto n: Go to frame n.
 read le type lename [beg nb℄ [end ne ℄ [skip ns℄ [mole ule number℄: Read data for
mole ule number from lename, beginning with frame nb, ending with frame ne, with a stride
of ns+1.
 write le type lename [beg nb℄ [end ne ℄ [skip ns℄ [mole ule number℄: Write data from
mole ule number to lename, beginning with frame nb, ending with frame ne, with a stride
of ns+1.
 delete [beg nb℄ [end ne℄ [skip ns℄ [mole ule number℄: Delete data for mole ule number,
beginning with frame nb, ending with frame ne, with a stride of ns+1.
 readdel lename [beg nb℄ [end ne℄ [skip ns℄ [mole ule number℄: Read data for mole ule number
from lename, beginning with frame nb, ending with frame ne, with a stride of ns+1, over-
writing existing data.

10.3.2 axes
The axes (orthogonal ve tors pointing along the x, y , and z dire tions) an be pla ed in any of 5
lo ations on the s reen, or turned o .

 lo ations: Return a list of possible lo ations.


 lo ation: Get the urrent lo ation.
 lo ation < o | origin | lowerleft | lowerright | upperleft | upperright >: Position
axes.

Also, though this may seem like a likely ommand for hanging the olor of the axes, this
fun tion an only be performed from the Colors form or by the olor ommand (see below).
Future implementations of VMD may hange this.

102
10.3.3 olor
Change the olor assigned to mole ules, or edit the olor s ale. All olor values are in the range
0 . . . 1. Please see the se tion on oloring [x 6℄ for a full des ription of the various options.
 ategory name olor: Set olor of obje t spe i ed by ategory and name to olor.
 s ale method < s ale name >: Set type of s ale to use for oloring obje ts by values. They
are:
{ RGB { Red to green to blue.
{ BGR { Blue to green to red.
{ RWB { Red to white to blue.
{ BWR { Blue to white to red.
{ RWG { Red to white to green.
{ GWR { Green to white to red.
{ GWB { Green to white to blue.
{ BWG { Blue to white to green.
{ BlkW { Bla k to white.
{ WBlk { White to bla k.
 s ale midpoint x: Set midpoint of olor s ale to x, in the range 0 . . . 1.
 s ale min x: Set minimum of olor s ale to x, in the range 0 . . . 1.
 s ale max x: Set maximum of olor s ale to x, in the range 0 . . . 1.
 hange < alpha | shininess | rgb | ambient | di use | spe ular > olor: Reset given
property of olor to default value.
 hange < alpha | shininess > olor value: Set given (s alar) property of olor to value.
 hange < rgb | ambient | di use | spe ular > olor r g b: Set given (3-valued) property
of olor to r g b.
See also Chapter x 12 on how to hange olor of a user-de ned graphi s obje t.

10.3.4 olorinfo
(T l) This ommand provides a ess to the olor de nitions. For information on the olor properties
see the hapter on Coloring [x6℄.

 olorinfo ategories: returns a list of available ategories


 olorinfo ategory ategory: returns a list of names for the given ategory
 olorinfo num: returns the number of base solid olors (17)
 olorinfo max: returns the total number of olors available (98)

103
 olorinfo olors: returns a list of the named solid olors
 olorinfo index < name | olorid >: returns the index of the given name or olor id.
Useful for the ases when you do need the integer value and don't want to use lsear h on
olorinfo olors.
 olorinfo <rgb | alpha | shininess | ambient | spe ular> < name | olorid >: returns
the appropriate values for the given name or olor id
 olorinfo s ale < method | methods | midpoint | min | max >: returns the information
about the olor s ales

Examples:

# find out what olor orresponds to whi h id:


set i 0
forea h olor [ olorinfo olors℄ {
puts "$i $ olor"
in r i
}

# also get a list of RGB values


set i 0
forea h olor [ olorinfo olors℄ {
lassign [ olorinfo rgb $ olor℄ r g b
puts "$i $ olor \{$r $g $b\}"
in r i
}

10.3.5 debug
Turn on/o printing of debugging messages. This will have no e e t if VMD was ompiled without
the debugging option (the standard distribution was not ompiled with debugging).

 < on | o >: Turn debug on or o .


 level n: Set debug level to n.

10.3.6 display
Change various aspe ts of the graphi al display window. For information about the options, see
the se tion des ribing the Display form [x3.3.8℄.

 update: For e the display update. Makes sense if the display update is o . This does not
ne essarily take are of resizing the display window or using the Forms GUI while the display
update is turned o .

104
 update on: Turn display update on.
 update o : Turn display update o . By default VMD does the display updates onstantly.
Sometimes it is bene ial to turn the turn the display updates o . This prevents VMD from
redrawing the s ene as a response to every hange, thus saving time while doing hanges of
representations. See se tions x16.6.2, x 6.4.3 and x 6.4.4 for examples of use.
 update status: Return the display update status (on or o ).
 update ui: Similar to display update, but also for es updates of the GUI forms. The
Forms interfa e is subje t to the following behavior: if the display update is set to off and
a tions (su h as, e.g., i onify/dei onify) have been performed to the Forms, the Form windows
do not get updated by just display update ommand, whereas display update ui for es
both updates to happen. Tk does not seem to have this problem, so this option will be ome
obsolete after swit hing to Tk graphi s user interfa e.
 reshape: Reshape the display. If the display update is turned o , and the display window
has been resized ommand display update updates the display, but does not ne essarily
respond to the resizing of the window.
 resetview: Reset the view.
 eyesep value: Set the eye separation to value.
 fo allength value: Set the fo al length to value.
 height value: Set the s reen height to value.
 distan e value: Set the s reen distan e to value.
 antialias < on | o >: Turn antialiasing on or o .
 depth ue < on | o >: Turn depth ueing on or o .
 depthsort < on | o >: Turn depth sorting on or o (useful in transparent mode)
 detail < full | at | lines | points | none >
 altdetail < full | at | lines | points | none >
 stereo mode: Set the stereo mode to mode.
 near lip < set | add > value: Add or set near lipping plane position to it value.
 far lip < set | add > value: Add or set far lipping plane position to value.
 get < eyesep | fo allength | height | distan e | antialias | depth ue | stereo |
proje tion | detail | altdetail | near lip | far lip >: Return information about the
given option.
 get < stereomodes | proje tions | details >: Return a list of the availalble values for
the given options. (See se tion x 3.3.8 and hapter x 9 for more information.)

105
10.3.7 e ho
Turn on/o e hoing of text ommands to the onsole. When this is turned on, text ommands read
from a le or from the VMD prompt are e hoed to the s reen before they are exe uted. Do not
onfuse this with the standard Unix e ho ommand.
 < on | o >: Turn e hoing on or o .

10.3.8 exit
Quit VMD.

 on rm: Use a form to verify with the user before quitting.


 [now℄: Quit without asking.
10.3.9 external
(T l) Communi ate T l ommands between di erent pro esses based on the T l-DP RPC fun tions
(optional). This ommand an set the ma hine up as a server (listening for ommands) or lient
(sending ommands) or both.

 on: Start VMD as a server on port 8639 (the number an be hanged by hanging the
variable vmd external port before starting VMD as a server). This lets any pro ess onne t
to VMD and send it new text ommands. By default, only pro esses from the same ma hine
an onne t to it, but that an be hanged with the host option. See the se tions on external
interfa es [x3.4.1℄ and remote ontrol of VMD [x14.8℄ for more information on how to use this
feature.
 o : Deny new external onne tions to be made. Old onne tions will still exist.
 host ma hinename (ma hinename ... ): Allow or deny new onne tions based on the address
of the requesting ma hine. The format for ea h ma hine on the list is the same as dp Host,
whi h is based on xhost so external host + allows new onne tions from anyone, external
host - denies all new onne tions, external host +foo allows onne tions from foo and
external host -bar +128.186.7.* will allow any ma hine from the Florida State physi s
department to onne t.
 onne t ma hinename: Establish onne tion with a VMD pro ess on the given ma hine.
The remote pro ess is the server and the pro ess establishing the onne tion is the lient.
 send ommand: Evaluate the ommand on the server pro ess.
 lose: Deta h from the server.

106
10.3.10 help
Display the on-line help le with an HTML viewer. See Chapter x 17 for information on how to
hange the default viewer (whi h is Nets ape).
 [ subje t℄: Jump to help orresponding to subje t.
Presently, \subje t" an be any one of the following words, whi h laun hes the asso iated URL.
To guarantee that the help system will work orre tly, you will probably want to start up your
web browser before hoosing one of these options. After you do this, VMD will properly dire t the
browser to the pages mentioned below.
Sour e Asso iated URL
faq http://www.ks.uiu .edu/Resear h/vmd/allversions/vmd faq.html
raster3d http://www.bms .washington.edu/raster3d
stride http://www.embl-heidelberg.de/stride/stride info.html
mds ope http://www.ks.uiu .edu/Resear h/mds ope/
homepage http://www.ks.uiu .edu/Resear h/vmd/
qui khelp http://www.ks.uiu .edu/Resear h/vmd/vmd help.html
babel http://www.eyesopen. om/babel.html
radian e http://radsite.lbl.gov/radian e/HOME.html
maillist http://www.ks.uiu .edu/Resear h/vmd/mailing list/
namd http://www.ks.uiu .edu/Resear h/namd/
vrml http://www.vrml.org/
rayshade http://www-graphi s.stanford.edu/~ ek/rayshade/rayshade.html
povray http://www.povray.org/
t l http://www.s ripti s. om/
software http://www.ks.uiu .edu/Resear h/vmd/allversions/related programs.html
userguide http://www.ks.uiu .edu/Resear h/vmd/vmd-1.3/ug/ug.html
Table 10.2: On-line Help Sour es

10.3.11 imd
Controls the onne tion to a remote simulation.
 onne t host port: onne t to an MD simulation running on the ma hine named host and
listening on port port. This ommand will fail if a previously-established onne tion has not
yet been dis onne ted.
 deta h: Dis onne t from the simulation; the simulation will ontinue to run.
 kill: Dis onne t from the simulation and also ause it to halt.
 pause: Pause the remote simulation.
 transfer rate: Set the rate at whi h new oordinates are sent by the remote simulation to
VMD to the spe i ed value.
 keep rate: Set the keep rate, i.e. the frequen y at whi h VMD saves simulation frames, to
the spe i ed value.

107
10.3.12 label
Turn on or o labels for the four ategories: atoms, bonds, angles, or dihedral angles. On e a label
is reated (given the list of asso iated atoms) it an be turned on or o until it is deleted. Also, the
value of the label over the traje tory an be saved to a le and viewed with an external program
su h as xmgr. In the following, ategory implies one of [Atoms|Bonds|Angles|Dihedrals℄.
 list: Return a list of available ategories.
 list ategory: List all labels in the given ategory.
 add ategory molID1/atomID1 [ molID2/atomID2... ℄: Add a label involving the atom(s)
atomID of the mole ule molID to the given ategory.
 show ategory < all | label number >: Turn on labels in the given ategory.
 hide ategory < all | label number >: Turn o labels in the given ategory.
 delete ategory < all |label number>: Delete labels in the given ategory.
 graph ategory label number [ ommand℄: Show a graph of a label from the given ategory.
The data will be written to a temporary le, and the spe i ed ommand will be run to graph
the data. %s in the ommand string will be repla ed by the temporary lename.

10.3.13 light
There are four light sour es, numbered 0 to 3, whi h are used to illuminate graphi al obje ts. They
are point sour es lo ated at in nity so the only ontrols are to rotate a light or turn it on or o . A
dotted line from the light to the axis an be turned on to help show where the light is lo ated.
 num: Return the number of lights available.
 light number on: Turn a light on.
 light number o : Turn a light o .
 light number highlight: Display a line indi ating the position of a light sour e.
 light number unhighlight: Hide the line indi ating the position of a light sour e.
 light number status: Return the pair on/o highlight/unhighlight
 light number rot < x | y | z > angle: Rotate a light (at in nity) angle degrees about a given
axis.

10.3.14 log le
Turn on/o logging a VMD session to a log le. This will reate a log le with ommands for
all the a tions taken during the session. The log le may be played ba k later by using the `play'
ommand or the T l `sour e' ommand. The only a tions re orded are those whi h hange the state
of the VMD display, so straight T l ommands are not saved. All of the ore VMD ommands will
write to the log.

108
 lename: Turn on logging to lename.
 o : Turn o logging.
To write log information to the le `o ', use the le name `./o '. To have log information appear
on the text onsole, use logfile /dev/tty.

10.3.15 menu
The menu forms of the GUI Control or query the on-s reen GUI menu forms.

 list: Return a list of the available menus


 menu name on: Turn a menu on.
 menu name o : Turn a menu o .
 menu name status: Return on if on, off if o .
 menu name lo : Return the x y lo ation.
 menu name move x y: Move a menu to the given (x, y) lo ation
where menu name is one of the following:

 main
 mol
 animate
 edit
 graphi s
 labels
 render
 display
 olor
 sim
 tra ker
 remote

Note that in the ase when VMD is ompiled without the REMOTE option, Sim and Remote menus
are not de ned and do not appear on the Main form [x3.3.1℄.

109
10.3.16 mol
Load, modify, or delete a mole ule in VMD. In the following, mole ule number is a string des ribing
whi h mole ules are to be a e ted by the ommand. It is one of the following: all, top, a tive,
ina tive, displayed, on, off, fixed, free, or one of the unique integer ID odes assigned to
the mole ules when they are loaded (starting with 0). The odes (molIDs) are not reused after a
mole ule is deleted, so if you, for example, have three mole ules loaded (numbered 0, 1, 2), delete
mole ule with molID equal to 0, and then load another mole ule, the new mole ule will have molID
3. Thus, the list of available mole ule IDs be omes (1 2 3). The index of the mole ule on this list
is, among many other things, a essible through the molinfo ommand [x13℄. In the above ase,
for example, mole ule that was loaded the last has molID equal to 3, however, it is the third on
the list of mole ules, so it has the index equal to 2 (sin e we start ountin from 0).
The mole ule representations (views) are assigned integer number (starting with 0 for ea h
mole ule), whi h appear in the list on the Graphi s form [x3.3.4℄. The representations an be
added, deleted or hanged with the mol ommand. See also se tions on molinfo ommand [x 13℄
for more ways of retrieving information about the representations. See Chapter x 12 for information
on how to use mol ommand to load user-de ned graphi s.

 < new | load > stru ture le type stru ture le [ oordinate le type oordinate le℄ : Load
a new mole ule from lename(s) using the given format.
 urlload < le type> <URL>: Load a mole ule from a given URL address
 pdbload <four letter a ession id>: ftp mole ule from PDB.
 list: Print a one-line status summary for ea h mole ule.
 list mole ule number: Print a one-line status summary for ea h mole ule mat hing the
mole ule number. If only one mole ule mat hes the mole ule number, also print the rep-
resentation status for this mole ule, i.e., number of representations as well as the representa-
tion number, oloring method , representation style and the sele tion string for ea h of the
representations.
 olor oloring method: Change the default atom oloring method setting.
 representation rep style: Change the default rendering method setting.
 sele tion sele t method: Change the default atom sele tion setting.
 mod olor rep number mole ule number oloring method: Change the urrent oloring method
for the given representation in the spe i ed mole ule.
 modstyle rep number mole ule number rep style: Change the urrent rendering method
(style) for the given representation in the spe i ed mole ule.
 modsele t rep number mole ule number sele t method: Change the urrent sele tion for the
given representation in the spe i ed mole ule.
 addrep: Using the urrent default settings for the atom sele tion, oloring, and rendering
methods, add a new representation to the top mole ule.

110
 delrep rep number mole ule number: Deletes the given representation from the spe i ed
mole ule.
 modrep rep number mole ule number: Using the urrent default settings for the atom se-
le tion, oloring, and rendering methods, hanges the given representation to the urrent
defaults.
 delete mole ule number: Delete mole ule(s).
 a tive mole ule number: Make mole ule(s) a tive.
 ina tive mole ule number: Make mole ule(s) ina tive.
 on mole ule number: Turn mole ule(s) on (make drawn).
 o mole ule number : Turn mole ule(s) o (hide).
 x mole ule number: Fix mole ule(s).
 free mole ule number: Un x mole ule(s).
 top mole ule number: Set the top mole ule.

10.3.17 mole ule


Same as mol.

10.3.18 mouse
Change the urrent state (mode) of the mouse.
 mode 0: Set mouse mode to rotation.
 mode 1: Set mouse mode to translation.
 mode 2: Set mouse mode to s aling.
 mode 3 N: Set mouse mode to rotate light N.
 mode 4 N: Set mouse mode to pi king mode N, where N is one of the following:
{ 0: query item
{ 1: pi k enter
{ 2: pi k atom
{ 3: pi k bond
{ 4: pi k angle
{ 5: pi k dihedral
{ 6: move atom
{ 7: move residue
{ 8: move fragment

111
{ 9: move mole ule
{ 10: for e on atom
{ 11: for e on residue
{ 12: for e on fragment

10.3.19 play
Start exe uting text ommands from a spe i ed le, instead of from the onsole. When the end of
the le is rea hed, VMD will resume reading ommands from the previous sour e. This ommand
may be nested, so ommands being read from one le an in lude ommands to read other les.

 lename: Exe ute ommands from lename.

10.3.20 quit
Same as exit.

10.3.21 imd
Set up VMD to onne t to or start a remote simulation program (optional).
 onne t

10.3.22 render
Output the urrently displayed image (s ene) to a le.

 list: List the available rendering methods.


 method lename: Render the global s ene to lename using method and exe ute the default
ommand, where method an be one of the following:
{ Raster3D
{ tkRaster3D
{ snapshot
{ POV3
{ POV
{ RayShade
{ Radian e
{ ART
{ PostS ript
{ STL
{ VRML-1

112
{ Token
 method lename ommand: Render the global s ene to lename, then exe ute ` ommand'.
Any %s in ` ommand' are repla ed by the lename (up to 5).
 options method: Get the default ommand string.
 options method ommand: Set new default ommand.
 default method: Get the original default ommand.

10.3.23 ro k
Rotate the urrent s ene ontinually at a spe i ed rate.

 o : Stops ro king.
 < x | y | z > by step: Ro k around the given axis at a rate of step degrees per redraw.
 < x | y | z > by step n: Ro k around the given axis at a rate of step degrees per redraw for
n steps, reverse, and repeat.

10.3.24 rotate
Rotate the urrent s ene around a given axis by a ertain angle. This does not hange atom
oordinates.

 stop: Stop all rotation, same as ro k o .


 < x | y | z > by angle: Rotate around the given axis angle degrees.
 < x | y | z > to angle: Rotate the given axis to the absolute position angle.
 < x | y | z > < by | to > angle step: Rotate at a rate of step degrees per redraw.

10.3.25 s ale
S ale the urrent s ene up or down. This does not hange atom oordinates.

 by f: Multiply s ene s aling fa tor by f.


 to f: Set s ene s aling fa tor to f.

113
10.3.26 sim
Control the state of a remote simulation after it is onne ted (optional).

 list: Return information about remote simulations. Ea h element returned ontains three
pie es of information; the mole ule id, the remote ma hine name, and the urrent status. The
status is one of:
{ No Conne tion: remote onne tion has been dis onne ted or stopped
{ Running Simulation: onne ted to an a tive simulation
 top sim number: Set the top simulation.
 top: Get the mole ule id of top simulation.
 modify parameter value: Change a parameter for the top simulation. Possible parameters
are
{ rate n: Send only every n simulation timesteps.
{ keep n: Keep only every n re eived timesteps, appended to the animation.
 pat h < o | byatom | byload | bynode >: Display the pat hes from a simulation (if
any), oloring them by the spe i ed riteria, for the top simulation.
 deta h sim number: Deta h from a simulation, leaving it running on the remote omputer.
 kill sim number: Kill a simulation.
10.3.27 simulation
Same as sim.

10.3.28 stage
Position a he kerboard stage on the s reen.

 lo ation < o | origin | bottom | top | left | right | behind >: Set the lo ation.
 lo ation: Get the urrent lo ation.
 lo ations: Get a list of possible lo ations.
 panels n: Set number of panels in stage, up to 30.
 panels: Get the number of panels in use

114
10.3.29 tool
Initialize and ontrol the tools that are ontrolled by external tra king devi es.

 reate: Create a new tool


 hange type [ toolid ℄: Change the type of a tool.
 s ale s ale [ toolid ℄: Change the s ale of the oordinates reported by a tool.
 s alefor e s ale [ toolid ℄: In rease or de rease the for e on a for e-feedba k devi e.
 rot [ left | right ℄ A00 A01 : : : A33 [ toolid ℄: Multiply a tool's orientation matrix on the
left or right by a matrix A.
 o set x y z [ toolid ℄: Add a ve tor to a tool's position.
 delete [ toolid ℄: Remove a tool.
 info [ toolid ℄: Get info about a tool.
 rep molid repid : Choose only a single representation for tugging or SMD.
 adddevi e name [ toolid ℄ : Add a devi e to a tool, using a name found in the sensor
on guration le.
 removedevi e name [ toolid ℄ : Remove a devi e from a tool, using a name found in the
sensor on guration le.

10.3.30 translate
Translate the obje ts in the urrent s ene. This does not hange the atom oordinates.

 by x y z: Translate by ve tor (x, y, z) in s reen units (note, that this does not hange the
atom oordinates).
 to x y z: Translate to the absolute position (x, y, z) in s reen units.

10.3.31 user
Add user- ustomized ommands to the graphi s display popup menu.
 add menu name: Add a new submenu name to the main popup menu. The submenu will
be initially empty, and will not appear until items are added to it.
 add item name ommand: Add a new menu item named name to the `User Command'
submenu of the main menu. If a ommand is spe i ed, then when the menu item is sele ted
by the user, that ommand will be exe uted as if it had been typed at the onsole.
 add separator: Add a separator to the end of the `User Command' submenu of the main
menu.

115
 add subitem menu name ommand: Add an item name to the given submenu menu, whi h
must have been added already with an add menu ommand. The given ommand will be
exe uted when the item is sele ted by the user.
 add subseparator menu: Add a separator to the end of the given submenu.
 add key key ommand: Assign the given text ommand to the hot key key. When key is
pressed while the mouse is in the display window, the spe i ed ommand will be exe uted.
 print < menus | keys >: Print out the urrent de nition of the user-de ned menus, or the
hot keys.
See se tion x 14.1 for examples of the use of the user ommand.

10.3.32 vmdlog
(T l) By default this pro edure does not exist. If it is reated, (nearly) every ommand that a e ts
the display state of VMD is passed to it as its single parameter. This an be used as an interfa e
alternative to the logfile [x10.3.14℄ ommand.

10.3.33 vmdinfo
(T l) Returns information about this version of VMD.
 version: Returns the version number;
 versionmsg: Full information about this version;
 authors: List of authors;
 ar h: ar hite ture type (in ase you ouldn't tell);
 options: options used to ompile VMD;
 www: VMD home page;
 wwwhelp: VMD help page.
This fun tion is available without T l and the information is displayed to the s reen.

10.3.34 wait
Spe ify a number of se onds to wait before reading another ommand. Animation ontinues during
this time.
 time: wait time se onds.

10.3.35 sleep
Spe ify a number of se onds to sleep before reading another ommand. Animation stops during
this time.
 time: sleep time se onds.

116
Chapter 11

Ve tors and Matri es


T l does not handle mathemati al expressions very well. It is slow at evaluating expressions, and
provides no fa ility for handling ve tors or matri es. Sin e the latter two are needed for stru ture
analysis, we have added routines to manipulate them. The routines themselves are independent of
VMD, but do require T lX for a ouple fun tions, su h as lassign. The routines are loaded during
the evaluation of the $env(VMDDIR)/s ripts/vmd/vmdinit.t l s ript.
A ve tor in VMD is a list of numbers. All of the ve tor routines but one will work with ve tors
of any length; ve ross will only use ve tors of three numbers. A matrix is a 4x4 olle tion of
numbers stored as a list of 4 ve tors of 4 numbers, in row-major form.
Following are des riptions and examples of all the ommands. For more examples of ve tors,
though without mu h do umentation, the s ript used to test the ve tors implementation is lo ated
at $env(VMDDIR)/s ripts/vmd/test-ve tors.t l. See also the hapter on writing s ripts for
VMD[x16℄.
Sin e T l is slow at math, some of these ommands have been reimplemented in C++. (The
original de nition is in the vmd s ript distribution, but it is rede ned later on inside VMD). At
times, the speedup is a fa tor of 40 or more. These ommands are noted by (C++).

11.1 Ve tors
 ve zero { Returns the zero ve tor, f0 0 0g
Example:
vmd > ve zero
Info) 0 0 0

 (C++) ve add v1 v2 [v3 ... vn℄ { Returns the ve tor sum of all the terms.

Examples:
vmd > ve add {1 2 3} {4 5 6} {7 8 9} {-11 -11 -11}
Info) 1 4 7
vmd > ve add {0.1 0.2 0.4 0.8} {1 1 2 3} {3 1 4 1}
Info) 4.1 2.2 6.4 4.8
vmd > ve add 4 5
Info) 9

117
 (C++) ve sub v1 v2 { Returns the ve tor subtra tion of the se ond term from the rst

Examples:
vmd > ve sub 6 3.2
Info) 2.8
vmd > ve sub {10 9.8 7} {0.1 0 -0.1}
Info) 9.9 9.8 7.1
vmd > ve sub {1 2 3 4 5} {6 7 8 9 10}
Info) -5 -5 -5 -5 -5

 (C++) ve s ale v {
 (C++) ve s ale v { Returns the ve tor of the s alar value applied to ea h term of v

Examples:
vmd > ve s ale .2 {1 2 3}
Info) 0.2 0.4 0.6
vmd > ve s ale {-5 4 -3 2} -2
Info) 10 -8 6 -4
vmd > ve s ale -2 3
Info) -6

 ve dot v1 v2 { Returns the s alar dot produ t of the two ve tors


Examples:
vmd > ve dot {1 -2 3} {4 5 6}
Info) 12
vmd > ve dot {3 4} {3 4}
Info) 25
vmd > ve dot {1 2 3 4 5} {5 4 3 2 1}
Info) 35
vmd > ve dot 3 -2
Info) -6

 ve ross v1 v2 { Returns the ve tor ross produ t of the two ve tors.


Examples:
vmd > ve ross {1 0 0} {0 1 0}
Info) 0 0 1
vmd > ve ross {2 2 2} {-1 0 0}
Info) 0 -2 2

 ve length v { Returns the s alar length of v (k k)


v

Examples:
vmd> ve length 5
Info) 5.0
vmd > ve length {5 12}

118
Info) 13.0
vmd > ve length {3 4 12}
Info) 13.0
vmd > ve length {1 -2 3 -4}
Info) 5.47723

 ve length2 v { Returns the square of the s alar length of v (k k2)


v

Examples:
vmd > ve length2 5
Info) 25
vmd > ve length2 {5 12}
Info) 169
vmd > ve length2 {3 4 12}
Info) 169
vmd > ve length2 {1 -2 3 -4}
Info) 30

 ve norm v { Returns the ve tor of length 1 dire ted along v


Examples:
vmd > ve norm -10
Info) -1.0
vmd > ve norm {1 1 }
Info) 0.707109 0.707109
vmd > ve norm {2 -3 1}
Info) 0.534522 -0.801783 0.267261
vmd > ve norm {2 2 -2 2 -2 -2}
Info) 0.408248 0.408248 -0.408248 0.408248 -0.408248 -0.408248

 ve dist v1 v2 { Returns the distan e between the two ve tors (k v2 v1 k)


Examples:
vmd > ve dist -1.5 5.5
Info) 7.0
vmd > ve dist {0 0 0} {3 4 0}
Info) 5.0
vmd > ve dist {0 1 2 3 4 5 6} {-6 -5 -4 -3 -2 -1 0}
Info) 15.8745

 ve invert v { Returns the additive inverse of v ( v).


Examples:
vmd > ve invert -11.1
Info) 11.1
vmd > ve invert {3 -4 5}
Info) -3 4 -5
vmd > ve invert {0 -1 2 -3}
Info) 0 1 -2 3

119
11.2 Matrix routines
Be ause matri es are rather large when expressed in text form, the following de nitions are used
for the examples.
 transidentity { Returns the identity matrix.
Example:
vmd > transidentity
Info) {1.0 0.0 0.0 0.0} {0.0 1.0 0.0 0.0} {0.0 0.0 1.0 0.0} {0.0 0.0 0.0 1.0}

 transtranspose m { Returns the matrix transpose of the given matrix


Example:
vmd > transtranspose {{0 1 2 3 4} {5 6 7 8} {9 10 11 12} {13 14 15 16}}
Info) {0 5 9 13} {1 6 10 14} {2 7 11 15} {3 8 12 16}

 (C++) transmult m1 m2 [m3 ... mn℄ { Returns the matrix multipli ation of the given
matri es
Examples:
vmd > set mat1 {{1 2 3 4} {-2 3 -4 5} {3 -4 5 -6} {4 5 -6 -7}}
vmd > set mat2 {{1 0 0 0} {0 0.7071 -0.7071 0} {0 0.7071 0.7071 0} {0 0 0 1}}
vmd > set mat3 {{0.866025 0 0 0} {0 1 0 0} {-0.5 0 0.866025 0} {0 0 0 1}}
vmd > transmult $mat1 [transidentity℄
Info) {1.0 2.0 3.0 4.0} {-2.0 3.0 -4.0 5.0} {3.0 -4.0 5.0 -6.0}
{4.0 5.0 -6.0 -7.0}
vmd > transmult $mat1 $mat2 $mat3
Info) {0.512475 3.5355 0.612366 4.0} {0.7428 -0.7071 -4.28656 5.0}
{-0.58387 0.7071 5.5113 -6.0} {7.35315 -0.7071 -6.73603 -7.0}

 transaxis x|y|z
< > amount [deg|rad|pi℄ { Returns the transformation matrix needed to
rotate around the spe i ed axis by a given amount. By default, the amount is spe i ed in
degrees, though it an also be given in radians or fa tors of pi.
Examples:
vmd > transaxis x 90
Info) {1.0 0.0 0.0 0.0} {0.0 -3.67321e-06 -1.0 0.0} {0.0 1.0 -3.67321e-06 0.0}
{0.0 0.0 0.0 1.0}
vmd > transaxis y 0.25 pi
Info) {0.707107 0.0 0.707107 0.0} {0.0 1.0 0.0 0.0}
{-0.707107 0.0 0.707107 0.0} {0.0 0.0 0.0 1.0}
vmd > transaxis z 3.1415927 rad
Info) {-1.0 -2.65359e-06 0.0 0.0} {2.65359e-06 -1.0 0.0 0.0} {0.0 0.0 1.0 0.0}
{0.0 0.0 0.0 1.0}

 transve v { Returns the transformation matrix needed to bring the x axis along the v
ve tor. This matrix is not unique, sin e a nal rotation is allowed around the ve tor. The
matrix is made from a rotation around y, then one about z.

120
Examples:
vmd > transve {0 1 0}
Info) {-3.67321e-06 -1.0 0.0 0.0} {1.0 -3.67321e-06 0.0 0.0} {0.0 0.0 1.0 0.0}
{0.0 0.0 0.0 1.0}
vmd > ve trans [transve {0 0 2}℄ {1 0 0}
Info) 0.0 0.0 1.0

 transve inv v { Returns the transformation needed to bring the ve tor v to the x axis. This
produ es the inverse matrix to transve , and is omposed of a rotation about z then one about
y.
Examples:
vmd > transve inv {0 -1 0}
Info) {-3.67321e-06 -1.0 0.0 0.0} {1.0 -3.67321e-06 0.0 0.0} {0.0 0.0 1.0 0.0}
{0.0 0.0 0.0 1.0}
vmd > ve trans [transve inv {-3 4 -12}℄ {-3 4 -12}
Info) 13.0 -1.8e-05 5.8e-05
vmd > transmult [transve {6 -5 7}℄ [transve inv {6 -5 7}℄
Info) {0.999999 2.29254e-07 -6.262e-09 0.0} {2.29254e-07 0.999999
-4.52228e-07 0.0} {-6.262e-09 -4.52228e-07 1.0 0.0} {0.0 0.0 0.0 1.0}

 (C++) transo set v { Returns the transformation matrix needed to translate by the given
o set
Examples:
vmd > transoffset {1 0 0}
Info) {1.0 0.0 0.0 1} {0.0 1.0 0.0 0} {0.0 0.0 1.0 0} {0.0 0.0 0.0 1.0}
vmd > transoffset {-6 5 -4.3}
Info) {1.0 0.0 0.0 -6} {0.0 1.0 0.0 5} {0.0 0.0 1.0 -4.3} {0.0 0.0 0.0 1.0}

 transabout v amount [deg|rad|pi℄ { Generates the transformation matrix needed to rotate


by the given amount ounter- lo kwise around axis whi h goes through the origin and along
the given ve tor. As with transve , the units of the amount of rotation an be degrees,
radians, or multiples of pi.
Examples:
# this is a rotation about x by 180 degrees
vmd > transabout {1 0 0} 180
Info) {1.0 0.0 0.0 0.0} {0.0 -1.0 -2.65359e-06 0.0} {0.0 2.65359e-06
-1.0 0.0} {0.0 0.0 0.0 1.0}
# a rotation about z by 90 degrees
# ( ompare this to "transaxis z 90"
vmd > transabout {0 0 1} 1.5709 rad
Info) {0.999624 -0.027414 0.0 0.0} {0.027414 0.999624 0.0 0.0}
{0.0 0.0 1.0 0.0} {0.0 0.0 0.0 1.0}
vmd > transabout {1 1 1} 1 pi
Info) {-0.333335 0.666665 0.666669 0.0} {0.666668 -0.333334 0.666666
0.0} {0.666666 0.66667 -0.333332 0.0} {0.0 0.0 0.0 1.0}

121
 trans [ enter fx y zg℄ [origin fx y zg℄ [o set fx y zg℄ [axis x amount [rad|deg|pi℄℄
[axis y amount [rad|deg|pi℄℄ [axis z amount [rad|deg|pi℄℄ [x amount [rad|deg|pi℄℄
[y amount [rad|deg|pi℄℄ [z amount [rad|deg|pi℄℄ [axis fx y zg amount [rad|deg|pi℄℄
[bond fx1 y1 z1g fx2 y2 z2g amount [rad|deg|pi℄℄ [angle fx1 y1 z1g fx2 y2 z2g fx3 y3
z3g amount [rad|deg|pi℄℄ {
This ommand an do almost everything the other ones an do, and then some. It is designed
to be the main fun tion used for generating transformation matri es.
Using it orre tly alls for understanding how it works internally. There are three matri es:
entering, rotation, and o set. The entering matrix determines where the enter of rotation is
lo ated. By default, this is the origin, but it an be hanged to pivot about any point. The
rotation matrix de nes the rotation about that entering point, and the o set matrix de nes the
nal translation after the rotation.
For example, to rotate around a given point, the transformations would be 1) the entering
matrix to bring that point to the origin, 2) the rotation about the enter, and 3) the nal o set to
return the origin ba k to its original lo ation.
The di erent options for the trans ommand modify the matri es in various ways.
{ enter fx y zg { Sets the entering matrix so that point x y z is brought to the origin
{ o set fx y zg { Sets the o set matrix so that the origin is brought to x y z
{ origin fx y zg { Sets both the entering and o set matri es to x y z
{ axis x amount [rad|deg|pi℄ { Adds a rotation about the x axis by the given amount to the
rotation matrix
{ axis y amount [rad|deg|pi℄ { Adds a rotation about the y axis by the given amount to the
rotation matrix
{ axis z amount [rad|deg|pi℄ { Adds a rotation about the z axis by the given amount to the
rotation matrix
{ axis fx y zg amount [rad|deg|pi℄ { Adds a rotation of the given amount about the given
ve tor to the rotation matrix
{ bond fx1 y1 z1g fx2 y2 z2g amount [rad|deg|pi℄ { Sets the enter and o set transforma-
tions to the rst point, and de nes a rotation about the bond axis by the given amount.
{ angle fx1 y1 z1g fx2 y2 z2g fx3 y3 z3g amount [rad|deg|pi℄ { Sets the enter and o set
transformation to the se ond point, and de nes a rotation about the axis perpendi ular to
the plane made by the three points (the ve tor is omputed from the ross produ t of the
ve tor onne ting the rst two points with that onne ted the last two).

11.3 Multiplying ve tors and matri es


There are two ommands to multiply a matrix and a ve tor, ve trans and oordtrans. They
assume the ve tor is in olumn form and premultiply the matrix to the ve tor. If the ve tor
ontains four numbers, the two ommands are identi al. If the ve tor has three elements, a fourth
is added; a 0 for ve trans and a 1 for oordtrans. The di eren e is that ve tors are not a e ted
by translations during transformations, while oordinates are.

122
 (C++) ve trans m v { Multiple the matrix m with the ve tor v (length 4); returns a ve tor
 oordtrans m v { Multiple the matrix m with the oordinate v (length 3); returns a ve tor
Examples:
vmd > ve trans [transaxis z 90℄ {1 0 0}
Info) -3.67321e-06 1.0 0.0
vmd > ve trans [transve inv {-3 4 -12}℄ {-3 4 -12}
Info) 13.0 -1.8e-05 5.8e-05

11.4 Mis . fun tions and values


Several other terms are added to the ve tors pa kage. The rst is the variable M PI, whi h ontains
the value of pi.
Examples:
vmd > set M_PI
Info) 3.14159265358979323846
vmd > expr 90 * ($M_PI / 180)
Info) 1.5708
The fun tions trans from rot, trans to rot, trans from offset, and trans to offset are
used to get or set a transformation matrix from either a 3x3 rotation matrix or o set ve tor. As
urrently designed, these assume there is no s aling in the matrix. The trans from offset is
identi al to transoffset and is present for ompleteness.
The last is find rotation value varname, whi h takes a variable name and extra ts from
the beginning of it those terms whi h des ribe an amount of rotation. The rest of the data in
the variable remains, and the amount of rotation, in radians, is returned. This is used by those
fun tions whi h need a rotation. The valid values are: a number, followed by one of rad, radian,
or radians for a value in radians, the word pi to give the rotation in fa tors of pi, or one of deg,
degree, or degrees for a value in degrees. If no units are given, the value is assumed to be in
degrees.
Examples:
vmd > set a "180 deg north"
Info) 180 deg north
vmd > find_rotation_value a
Info) 3.14159
vmd > set a
Info) north
vmd > set a "1 pi to eat"
Info) 1 pi to eat
vmd > find_rotation_value a
Info) 3.14159
vmd > set a
Info) to eat
vmd > set a 45
Info) 45

123
vmd > find_rotation_value a
Info) 0.785398
vmd > expr $M_PI * 3.0 / 2.0
Info) 4.71239
vmd > set a "4.71238 radians"
Info) 4.71238 radians
vmd > find_rotation_value a
Info) 4.71238

124
Chapter 12

User-De ned Graphi s


Sometimes you may want to display graphi s other than the standard mole ular graphi s. You
may want to draw a box around a mole ule, or an arrow between two atoms, or pla e a text label
somewhere in spa e, or test a new method for visualizing a mole ule. Be ause of the wide range
of obje ts whi h an be displayed, VMD annot be pre-programmed to display them all. Instead,
it does o er a way to build up a new obje t from simple graphi al items, in luding: points, lines,
ylinders, ones, spheres, triangles (both with and without spe i ed normals), and text. Sin e these
are displayed in the s ene just like all other graphi s, they an also be saved to the various ray
tra ing formats.
This hapter des ribes how to use the text interfa e to add new graphi s to VMD. It is broken
up into four parts. The rst is an introdu tion to the basi graphi s available, the se ond is a
tutorial whi h demonstrates many of the ways to use the graphi s feature, the third des ribes how
the base graphi s ommand works, and the last des ribes the draw extension whi h an handle
larger, more ompli ated obje ts.

12.1 Introdu tion


There are 10 types of basi graphi al items built into VMD, whi h are used with graphi s and
draw ommands. These are:
 point fx y zg {
draws a point at the given position
 line fx1 y1 z1g fx2 y2 z2g [width w℄ [style solid|dashed ℄
< > {
draws either a solid or dashed line of the given width from the rst point to the se ond. By
default, this is a solid line of width 1. A aution about the line width from the SGI man page
for linewidth(3G):
The maximum width of aliased lines is 255.

IRIS-4D VGX model supports antialiased line widths 1.0 and 2.0, and
aliased line widths one through 255. IRIS-4D G, GT, and GTX models, the
Personal Iris, Indy, Iris Entry, XL, XS, XS24, XZ, Elan and Extreme
systems support antialiased line width 1.0, and aliased line widths one
through 255.

125
Note that there is a known bug in VMD whi h auses it to mix up and lose tra k of the
anti-alias and depth- ue modes.
 ylinder fx1 y1 z1g fx2 y2 z2g [radius r℄ [resolution n℄ [ lled yes|no ℄ {
< >

draws a ylinder of the given radius (default r=1) from the rst point to the se ond. The
ylinder is a tually drawn as an n sided polygon. If the filled option is true (default), the
ends are apped with at disks, otherwise the ylinder is hollow.
 one fbasex basey basezg ftipz tipy tipzg [radius r℄ [resolution n℄ {
draw a one with the enter of the base at the rst point and the tip at the se ond. The
radius(default r=1) determines the width of the base. As with ylinder, the resolution
determines the number of polygons used in the approximation.
 triangle fx1 y1 z1g fx2 y2 z3g fx3 y3 z3g {
draws a triangle with endpoints at ea h of the three verti es
 trinorm fx1 y1 z1g fx2 y2 z3g fx3 y3 z3g fnx1 y1 z1g fnx2 ny2 nz3g fnx3 ny3 nz3g {
draws a triangle with endpoints at ea h of the rst three points. The se ond group of three
values spe ify the normals for the three points. This is used for making a smooth shading
a ross the triangle.
 sphere fx y zg [radius r℄ [resolution n℄ {
draws a sphere of the given radius (default r=1) entered at the vertex. The resolution
(default n=6) determines how many polygons are used in the approximation of a sphere.
 text fx y zg \text string" {
displays the text string with the bottom left of the string starting at the given vertex.
 olor olorId {
 olor name {
 olor trans name { Ea h of the above geometri al obje ts are drawn using the urrent olor.
Initially, that olor is blue, whi h has the olorid of 0. The olor ommand hanges the
urrent olor, and stays info e e t until the next olor ommand. Thus, to draw a red
ylinder then a red sphere, rst use the ommand olor red ommand to hange the olor,
then use the ylinder and sphere ommands.
 materials on|o
< > { Material properties are used to make the graphi al obje ts (lines,

ylinders, et .) be a e ted by the light sour es. These make the obje ts look more realisti ,
but are slower on ma hines whi h don't implement materials in hardware (see hapter x 6
and se tions on olor [x 10.3.3℄ and olorinfo [x 10.3.4℄ ommands for the information on how
to turn o material hara teristi s for all obje ts in VMD). One surprising e e t of material
hara teristi s is that lines are a e ted. In some lighting situations, the lines an even appear
to disappear. Thus, you may want to turn o materials before drawing lines.

126
12.2 Tutorials and Examples
We'll start with some basi examples. Load VMD and enter:
draw ylinder {0 0 0} {5 0 0} radius 0.2
VMD will print:
Info) Loading new mole ule ...
be ause of the way graphi s are implemented (don't worry about the details yet) and draw a blue
ylinder on the s reen.
Now hange the olor to red and draw two more ylinders:
draw olor red
draw ylinder {4 1 0} {5 0 0} radius 0.1
draw ylinder {4 -1 0} {5 0 0} radius 0.1
You might want to reset the view. Sin e the original s ene had no data, a default size was hosen.
Now that there is data, a reset view will enter the graphi s just as if it was a regular mole ule (in
fa t, the implementation is a mole ule with no atoms and only graphi s). You now have a simple
arrow. Let's make a ni er looking one now. First, remove all the graphi s:
draw delete all
and make a ylinder with a one on the end
draw ylinder {0 0 0} {4 0 0} radius 0.1
draw one {4 0 0} {5 0 0} radius 0.15
Note that the widest part of the one is at the rst point. As long as we're at it, let's add some
text to the end of the arrow in green
draw olor green
draw text {5 0 0} "This way"
Cool, eh? Of ourse, more things are available than a ylinder, one, and text. How about a sphere?
draw sphere {0 0 0} radius 0.3
draw sphere {0 2 0} radius 0.2
The olor of the spheres is green be ause that was the previously assigned olor. The olor doesn't
hange until expli itly spe i ed with the olor option. The default olor is blue.
And some lines, rst, a dotted line onne ting the spheres
draw line {0 0 0} {0 2 0} style dashed
then a solid one from the se ond sphere to the end of the arrow
draw line {0 2 0} {5 0 0}
Now, reset the view and move things around a bit. You may be surprised to see the lines appear
and disappear. This is be ause the lines have a "material property"; whi h means they are a e ted
by the lights. For some things, this may be useful, but usually if you want to draw lines, you'll
need to turn materials o .
draw materials off

127
12.2.1 Drawing a graph
Here's an example of how to draw a 2-D graph. First, get rid of the urrent graphi s (sin e there
may be graphi s from the previous tutorial):
draw delete all
De ne a fun tion to graph, in this ase, a parabola.
pro f {x} {
expr $x * $x
}
The following fun tion draws a graph given the fun tion name, the start and end values, and
the step size.
pro draw_graph {fun tion start end step} {
# do some error he king
if {$step < 0} {set step -$step}
if {$step == 0} {error "draw_graph: annot have step size of zero"}
if {$start > $end} {
set tmp $start
set start $end
set end $tmp
}
# turn materials off
draw materials off
# draw the data in green
draw olor green

# al ulate and save the initial oordinates


set y0 [$fun tion $start℄
set x0 $start
set miny $y0
set maxy $y0

# go through the oordinates $start+$step to $end, $step at a time


for {set x1 [expr $start + $step℄} {$x1 <= $end} {
set x1 [expr $x1 + $step℄} {
# al ulate the fun tion value for this point
set y1 [$fun tion $x1℄
# and draw a line to onne t the previous point to the urrent one
draw line "$x0 $y0 0" "$x1 $y1 0"
# save the min/max values of y, and opy the x1,y1 into x0,y0
if {$y1 < $miny} {set miny $y1}
if {$y1 > $maxy} {set maxy $y1}
set y0 $y1
set x0 $x1
}

128
# draw a red box around everything
draw olor red
draw line "$start $miny 0" "$end $miny 0"
draw line "$start $miny 0" "$start $maxy 0"
draw line "$end $maxy 0" "$end $miny 0"
draw line "$end $maxy 0" "$start $maxy 0"
# and put some labels down
draw text "$end $miny 0" "x ->"
draw text "$start $maxy 0" "f(x)"
}
Copy these two de nitions into VMD's text onsole (this s ript is available from the VMD s ript
library at http://www.ks.uiu .edu/Resear h/vmd/s ript library/), then enter
draw_graph f -5 4 0.2
and reset the view. Presto, a ni e little parabola.

12.2.2 Triangles
If you want to draw the surfa e of a solid obje t you an build it out of triangles. The graphi s
interfa e to VMD supports two types of triangles, simple triangles with just the orners de ned, or
"trinorms" whi h have normals de ned for ea h orner.
First, a simple red triangle
draw delete all
draw olor red
draw triangle {1 0 0} {0 1 0} {0 0 1}
Not bad, so let's put some more in
draw triangle {1 0 0} {0 1 0} {0 0 -1}
draw triangle {1 0 0} {0 -1 0} {0 0 1}
draw triangle {1 0 0} {0 -1 0} {0 0 -1}
draw triangle {-1 0 0} {0 1 0} {0 0 1}
draw triangle {-1 0 0} {0 1 0} {0 0 -1}
draw triangle {-1 0 0} {0 -1 0} {0 0 1}
draw triangle {-1 0 0} {0 -1 0} {0 0 -1}
And you have yourself an o tahedron. See how the olors on the fa es don't go smoothly from
one side to the next? This is be ause the surfa e normals for one fa e are quite di erent from
another, so the lights are re e ted di erently. The olors an be made smoother by de ning the
normals for the orners su h that the normals of the edges are the same. One aution about
de ning the verti es and normals: they must be given in ounter- lo kwise order or the shading
will be wrong.
As an example, here's the above o tahedron with the normals spe i ed:
draw delete all
draw olor red
draw trinorm {1 0 0} {0 1 0} {0 0 1} {1 0 0} {0 1 0} {0 0 1}

129
draw trinorm {1 0 0} {0 0 -1} {0 1 0} {1 0 0} {0 0 -1} {0 1 0}
draw trinorm {1 0 0} {0 0 1} {0 -1 0} {1 0 0} {0 0 1} {0 -1 0}
draw trinorm {1 0 0} {0 -1 0} {0 0 -1} {1 0 0} {0 -1 0} {0 0 -1}
draw trinorm {-1 0 0} {0 0 1} {0 1 0} {-1 0 0} {0 0 1} {0 1 0}
draw trinorm {-1 0 0} {0 1 0} {0 0 -1} {-1 0 0} {0 1 0} {0 0 -1}
draw trinorm {-1 0 0} {0 -1 0} {0 0 1} {-1 0 0} {0 -1 0} {0 0 1}
draw trinorm {-1 0 0} {0 0 -1} {0 -1 0} {-1 0 0} {0 0 -1} {0 -1 0}

12.2.3 Draw a surfa e plot


The following will plot the surfa e of a given fun tion from 5 <= x; y <= 5. (This is a bit more
ompli ated, so I don't want to in lude as mu h error he king for the inputs.)
The graphi s here will be the fun tion
pro g {x y} {expr sqrt(abs($x*$y))}

pro draw_surfa e { f } {
set minx -5
set maxx 5
set miny -5
set maxy 5
set step 0.5
# first, get the data (this isn't the most data effi ient way of
# doing things)
for {set i $minx} {$i <= $maxx} {set i [expr $i + $step℄} {
for {set j $miny} {$j <= $maxy} {set j [expr $j + $step℄} {
set data($i,$j) [$f $i $j℄
}
}
# make another pass through to plot it
for {set i $minx} {$i <= [expr $maxx - $step℄} {set i [expr $i + $step℄} {
for {set j $miny} {$j <= [expr $maxy - $step℄} {set j [expr $j + $step℄} {
# get the next two orners
set i2 [expr $i + $step℄
set j2 [expr $j + $step℄
# find the middle
set imiddle [expr $i + $step/2℄
set jmiddle [expr $j + $step/2℄
set kmiddle [expr ($data($i,$j) + $data($i2,$j) + $data($i2,$j2) \
+ $data($i,$j2)) / 4.0℄
# use a ool oloring s heme (this depends on the graph having a min
# value of 0 and max of 5, or at least less than about 30)
draw olor [expr 34 + [int [expr 6 * $kmiddle℄℄ % 32℄
# make 4 triangles
draw triangle "$i $j $data($i,$j)" "$imiddle $jmiddle $kmiddle" \
"$i2 $j $data($i2,$j)"
draw triangle "$i $j $data($i,$j)" "$i $j2 $data($i,$j2)" \

130
"$imiddle $jmiddle $kmiddle"
draw triangle "$i2 $j2 $data($i2,$j2)" "$i2 $j $data($i2,$j)" \
"$imiddle $jmiddle $kmiddle"
draw triangle "$i2 $j2 $data($i2,$j2)" "$imiddle $jmiddle $kmiddle" \
"$i $j2 $data($i,$j2)"
}
}
}
And graph it with the ommand:
draw_surfa e g
Looks like it should be on a quilt, doesn't it?

12.2.4 Drawing a box around a mole ule


Here's a qui k fun tion to draw a box around a mole ule. Delete any graphi s you may have loaded
and enter this s ript.
pro box_mole ule {molid} {
# get the min and max values for ea h of the dire tions
# (I'm not sure if this is the best way ... )
set sel [atomsele t top all℄

set oords [lsort -real [$sel get x℄℄


set minx [lindex $ oords 0℄
set maxx [lindex [lsort -real -de reasing $ oords℄ 0℄

set oords [lsort -real [$sel get y℄℄


set miny [lindex $ oords 0℄
set maxy [lindex [lsort -real -de reasing $ oords℄ 0℄

set oords [lsort -real [$sel get z℄℄


set minz [lindex $ oords 0℄
set maxz [lindex [lsort -real -de reasing $ oords℄ 0℄

# and draw the lines


draw materials off
draw olor yellow
draw line "$minx $miny $minz" "$maxx $miny $minz"
draw line "$minx $miny $minz" "$minx $maxy $minz"
draw line "$minx $miny $minz" "$minx $miny $maxz"

draw line "$maxx $miny $minz" "$maxx $maxy $minz"


draw line "$maxx $miny $minz" "$maxx $miny $maxz"

draw line "$minx $maxy $minz" "$maxx $maxy $minz"


draw line "$minx $maxy $minz" "$minx $maxy $maxz"

131
draw line "$minx $miny $maxz" "$maxx $miny $maxz"
draw line "$minx $miny $maxz" "$minx $maxy $maxz"

draw line "$maxx $maxy $maxz" "$maxx $maxy $minz"


draw line "$maxx $maxy $maxz" "$minx $maxy $maxz"
draw line "$maxx $maxy $maxz" "$maxx $miny $maxz"
}
If you don't already have a mole ule loaded, load one, e.g.,
mol load pdb $env(VMDDIR)/proteins/alanin.pdb
and make it the top mole ule. Then exe ute the ommand:
box_mole ule top
(you ould also enter the mole ule id instead of top).

12.2.5 Adding a label


Here's a qui k way to add your own label to an atom sele tion [x7℄. This fun tion take the sele tion
text and the labels that atom (in the top mole ule) with the given string. It returns with an error
if more anything other than one atom is sele ted.
pro label_atom {sele tion_string label_string} {
set sel [atomsele t top $sele tion_string℄
if {[$sel num℄ != 1} {
error "label_atom: '$sele tion_string' must sele t 1 atom"
}
# get the oordinates of the atom
lassign [$sel get {x y z}℄ oord
# and draw the text
draw text $ oord $label_string
}

12.2.6 Interfa e to pi king


When an atom is pi ked with the mouse, the T l variable vmd pi k mol gets set to the moleule id
of the pi ked mole ule, and vmd pi k atom ontains the atom index. The T l ommand tra e an
be used to all a fun tion when those values hange.
As an example of what an be done with this, the following statements will put a sphere around
ea h atom when it has been pi ked with the mouse. To turn it o , exe ute
tra e vdelete vmd pi k atom w sphere pi k.
pro sphere_pi k {name element op} {
# get the atom and mole ule pi ked
global vmd_pi k_atom vmd_pi k_mol
# get the oordinates
set sel [atomsele t $vmd_pi k_mol "index $vmd_pi k_atom"℄
lassign [$sel get {x y z}℄ oords

132
draw sphere $ oords radius 1.0
}
tra e variable vmd_pi k_atom w sphere_pi k

12.2.7 Animation
One last example of what an be done with the user-de ned graphi s. While VMD is not designed
for animation, it an be made to animate obje ts by repeating the y le of drawing the obje ts
then alling the display update ommand. Here's an example whi h has several balls swinging
(non-physi ally) at the end of a hain. If you want to stop it before it nishes, use <Ctrl-C>, but
if you at h it in the wrong pla e and nothing moves, you'll need to exe ute the ommand display
update on (see se tion x 10.3.6 for details about display updates.
pro swing {} {
# get rid of everything else (if there is anything)
if [expr [molinfo top℄ != -1℄ { mol off all }
# reate a new graphi s mole ule to handle just this
mol load graphi s "swing"
set mol [molinfo top℄
set enter {0 0.5 0}
set radius 0.125
set offset ".25 0 0"
set length 1
set firsttime 1
display resetview
axes lo ation off
stage lo ation off
for {set i 0} {$i < 1000} {in r i} {
display update off
s ale by 1.003
rotate y by 5
display update on
set top1 [ve sub $ enter $offset℄
set top2 $ enter
set top3 [ve add $ enter $offset℄
# ompute the bottom lo ation
set bot1 [ve sub $top1 "0 $length 0"℄
set bot2 [ve sub $top2 "0 $length 0"℄
set bot3 [ve sub $top3 "0 $length 0"℄
set xdiff [expr sin($i/10.0)℄
set ydiff [expr 1.0 - abs( os($i/10.0))℄

if [expr $xdiff < 0℄ {


set bot1 [ve add $bot1 "$xdiff $ydiff 0"℄
} else {
set bot3 [ve add $bot3 "$xdiff $ydiff 0"℄
}

133
if $firsttime {
set firsttime 0
display resetview
} else {
graphi s $mol delete all
}
# draw the three different balls/strings in different olors
graphi s $mol olor red
graphi s $mol sphere $bot1 radius $radius
graphi s $mol olor green
graphi s $mol sphere $bot2 radius $radius
graphi s $mol olor blue
graphi s $mol sphere $bot3 radius $radius
graphi s $mol materials off
graphi s $mol olor red
graphi s $mol line $top1 $bot1
graphi s $mol olor green
graphi s $mol line $top2 $bot2
graphi s $mol olor blue
graphi s $mol line $top3 $bot3
display reshape
}
display update on
}

12.3 Graphi s
This se tion des ribes te hni al aspe ts of how the graphi s ommands are implemented and used.
It should be read by those who want to understand how to build s ript-level extensions and those
who like knowing more about how things work.
The user ontrolled graphi s are implemented as if they are mole ules of zero length whi h
ontains only a list of graphi al obje ts. (Indeed, internally the lass is alled \Mole uleGraphi s"
and is derived from the Mole ule lass.) Thus, all the normal ontrols are appli able, and this is
why the graphi s \mole ules" are on the Mol form. This simpli es matters as many of the ontrols,
su h as the mouse ontrols, do not need to be dupli ated. However, some of the ommands that
apply only to mole ules then make no sense, su h as the graphi s form.
Multiple graphi s lists an be reated. Sin e they are just spe ializations of a normal mole ule,
they are reated with the mol load ommand, just like any other mole ule. The full ommand is:
 mol load graphi s name
The name parameter should be a disti tive string related to the mole ule. For instan e, if the
purpose of a new graphi s list is to read in a graphi s le format, the name should be the le name.
If it is a method of viewing data from another, loaded mole ule, the name should ontain the name
of the method and the mole ule Id of the mole ule from whi h it was derived. VMD reserves the
name \graphi s" for use with the draw ommand as that ommand always adds its graphi s to the
last graphi al mole ule with that name.

134
On e the graphi s list is loaded and on the list of mole ules, it an be distinguished from a
normal mole ule by using the molinfo <molID> get sour e ommand, whi h returns \Graphi s"
for graphi s mole ules.
The information pertaining to a given graphi s list is a essed via the graphi s ommand,
whi h is of the following form:
 graphi s mole ule id ommand [options ...℄
< >

where the "mole ule id" is the id of the graphi s mole ule on the mole ule list. The ommand eld
an be one of the graphi al items listed in se tion x12.1, or one of the ommands exists, delete,
repla e, list or info. The graphi s ommand returns a value, whi h depends on the ommand
given.
As graphi al primitives are added to the list they are assigned a unique, in reasing value. The
rst obje t added is assigned 0, the se ond is assigned 1, et . The ommands whi h add an item
return its value. A list of the available obje t ids is available with the list ommand. To test if a
spe i primitive exists, use the exists ommand followed by the obje t index. This returns a 1
if the index exists, and 0 if it does not. Information an be retrieved about a given item with the
info ommand. This takes one option, whi h is the number of graphi al information from whi h
information is desired.
A given primitive is deleted with the delete ommand followed by the index of the obje t to
delete. It does not have a return value. If the parameter is the string all, then all the primitives
are deleted and the index ount reset to 0.
Another deletion method allows one primitive to be repla ed by another; suspi iously enough,
this is the repla e ommand. What it does is delete the given primitive and set things up so
the next primitive is put in the same spot on the list and given the same index. This is designed
for situations where the graphi s are ompli ated to build, but where the olors might want to be
easily hanged. The olor de nition an be repla ed without needing to rebuild the full list.
Here are examples of all the above ommands:
vmd > mol load graphi s testing
Info) Loading new mole ule ...
vmd > graphi s top sphere {0.1 0.2 0.3} radius 0.4
Info) 0
vmd > graphi s top ylinder {-1 -1 -1} {2.6 2.5 2.4} resolution 3
Info) 1
vmd > graphi s top line {0 0 0} {3 0 0} style dashed
Info) 2
vmd > graphi s top delete 1
vmd > graphi s top list
Info) 0 2
vmd > graphi s top exists 0
Info) 1
vmd > graphi s top exists 1
Info) 0
vmd > graphi s top info 0
Info) sphere {0.100000 0.200000 0.300000} radius 0.400000 resolution 6
vmd > graphi s top repla e 0
vmd > graphi s top point {3.3 2.2 1.1}

135
Info) 0
vmd > graphi s top info 0
Info) point {3.300000 2.200000 1.100000}
vmd > graphi s top list
Info) 0 2

12.4 Draw and Drawing Extensions


The draw ommand is a straight T l fun tion whi h is meant to simplify the interfa e to the
graphi s ommand as well as provide a base for extensions to the standard graphi s primitives.
The format of the draw ommand is:
 draw ommand [arguments℄
Unlike the graphi s ommand, draw does not take a mole ule index by default. Instead, it
sear hes for the last graphi al mole ule with the name \graphi s" and uses that. (If su h a mole ule
doesn't exist, it is reated.) The basi ommands are identi al to those used by graphi s. However,
if the ommand doesn't work or doesn't exists, VMD tries to nd an extension draw fun tion.
This is done by sear hing for a fun tion of the form vmd draw $ ommand. If the fun tion exists,
it is alled with the rst parameter the mole ule index and the rest are the arguments from the
original draw all.
Here's an example whi h extends the draw ommand to in lude an \arrow" primitive.
pro vmd_draw_arrow {mol start end} {
# an arrow is made of a ylinder and a one
set middle [ve add $start [ve s ale 0.9 [ve sub $end $start℄℄℄
graphi s $mol ylinder $start $middle radius 0.15
graphi s $mol one $middle $end radius 0.25
}

and here's one whi h adds the \ olor" option to the \ ylinder primitive. It works be ause the draw
ommand tries the \graphi s" ommand and fails, be ause the \ olor" option doesn't exist. At
that point, the extensions are he ked.
pro vmd_draw_ ylinder {mol start end args} {
if [expr [llength $args℄ % 2℄ {
error "draw: ylinder: in orre t argument list"
}
# start the onstru tion of the graphi s ommand
set opts [list graphi s $mol ylinder℄
lappend opts $start $end
# sear h for the " olor" option
while {[string ompare $args {}℄} {
# get the parameter and value
set a [lvarpop args℄
set b [lvarpop args℄
# he k if it is the olor ommand
if [string ompare $a " olor"℄ {

136
# if it isn't, save the options
lappend opts $a $b
} else {
# otherwise, save the olor
set olor $b
}
}
# all the graphi s ommands
graphi s $mol olor $ olor
eval $opts
}

137
Chapter 13

Mole ular information: molinfo and


atomsele t

This Chapter overs how to extra t information about mole ules and atoms using the VMD text
ommands molinfo and atomsele t.

13.1 molinfo
The molinfo ommand is used to get information about a mole ule (or loaded le) in luding the
number of loaded atoms, the lename, the graphi s sele tions, and the viewing matri es. It an
also be used to return information about the list of loaded mole ules.

13.1.1 Using molinfo to a ess the mole ule list


The mole ule list ontains information about all the loaded mole ules, in luding those whi h are
not properly alled mole ules, su h as a Raster3D le or \graphi s" mole ule (see se tion x12).
Ea h mole ule has a unique id, whi h is assigned to it when it is rst loaded. These start at zero
and in rease by 1 for ea h new mole ule. When a mole ule is deleted, the number is not used
again. There is one unique mole ule, alled the top mole ule top mole ule [x3.3.2℄, whi h is used to
determine some parameters, su h as the enter of view, the data in the animation form, et .
The list of available mole ule ids is available with the ommand molinfo list, and the number
of loaded mole ules is found with molinfo num. The ommand molinfo top returns the id of the
top mole ule. One other ommand, molinfo <num> get index, returns the num'th mole ule
index on the list, starting from 0. (See se tion x10.3.16). In all ases, a mole ule id of -1 is returned
when no other valid id exists.
Examples:
vmd > molinfo list
Info) 0 1 2
vmd > molinfo top
Info) 2
vmd > mol top 1
vmd > molinfo top
Info) 1
vmd > molinfo num

138
Info) 3
vmd > mol delete 1
Info) Deleted 1 mole ules.
vmd > molinfo list
Info) 0 2
vmd > molinfo top
Info) 2
vmd > molinfo index 1
Info) 2

13.1.2 Using molinfo to a ess information about a mole ule


The molinfo ommand an also be used to a ess and, in some ases, modify information spe i
to a given mole ule. A query is in the form:
 molinfo mole ule id get flist of keywordsg
and the result is a list of elements, one for ea h keyword.
Examples:
vmd > molinfo top get numatoms
Info) 568
vmd > molinfo 0 get {sour e filename}
Info) File /home/dalke/pdb/pti.pdb
This next example is a bit more ompli ated. It loops through all the graphi al representation
(numreps) and, for ea h one, gets the representation used (rep), the sele tion text (sele tion),
and the oloring method ( olor).
vmd > for {set i 0} {$i < [molinfo top get numreps℄} {in r i} {
? lassign [molinfo top get "{rep $i} {sele tion $i} { olor $i}"℄ a b
? puts "view $i:"
? puts " representation: $a"
? puts " sele tion: $b"
? puts " oloring method: $ "
? }
view 0:
representation: Tube 0.300000 8.000000
sele tion: protein ba kbone
oloring: method Stru ture
view 1:
representation: Lines 2.000000
sele tion: same residue as name "S.*"
oloring: method ResName
view 2:
representation: VDW 1.000000 6.000000
sele tion: name "S.*"
oloring: method Name

139
A similar behavior an be a hieved by using mol list top , in whi h ase, however, there is no
dire t a ess to the data. A omplete list of keywords is given in Table 13.1.2.
The molinfo ommand, ontrary to its name, an also be used to set some keyword values, su h
as the urrent frame number and the display state ags. This dupli ates some of the fun tionality
of the mol ommand, though there are distin t di eren es in the implementation. Spe i ally, the
mol ommand uses the internal ommand queue whi h, among other things, noti es the appropriate
forms that a hange o ured, redraws the graphi s, and logs the ommands to the log le, of logging
is enabled. In future versions of VMD there will be only one ommand; for now we suggest only
using the molinfo ommand to get information and to set the frame value and the various viewing
matri es.
Examples:
Two fun tions, one to save the urrent view position, the other to restore it. The position of
the axis is not hanged by these operations.
pro save_viewpoint {} {
global viewpoints
if [info exists viewpoints℄ {unset viewpoints}
# get the urrent matri ies
forea h mol [molinfo list℄ {
set viewpoints($mol) [molinfo $mol get {
enter_matrix rotate_matrix s ale_matrix global_matrix}℄
}
}
pro restore_viewpoint {} {
global viewpoints
forea h mol [molinfo list℄ {
puts "Trying $mol"
if [info exists viewpoints($mol)℄ {
molinfo $mol set { enter_matrix rotate_matrix s ale_matrix
global_matrix} $viewpoints($mol)
}
}
}
Cy le through the list of displayed mole ules, turning ea h one on one at a time. At the end,
return the display ags to their original state.
# save the urrent display state
forea h mol [molinfo list℄ {
set disp($mol) [molinfo $mol get drawn℄
}
# turn everything off
mol off all
# turn ea h mole ule on then off again
forea h mol [molinfo list℄ {
if $disp($mol) {
mol on $mol
sleep 1

140
mol off $mol
}
}
# turn the original ones ba k on
forea h mol [molinfo list℄ {
if $disp($mol) {mol on $mol }
}
The last loop, whi h turns the originally drawn mole ules ba k on, doesn't turn them on at
the same time. That's be ause some ommands (those whi h use the ommand queue) redraw the
graphi s when they are used. This an be disabled with the display update (see se tion x 10.3.6
for more information). Using this, the nal loop be omes
#turn the original ones ba k on
display update off
forea h mol [molinfo list℄ {
if $disp($mol) {mol on $mol }
}
display update on
Alternatively, sin e the drawn option is settable, you ould do:
forea h mol [molinfo list℄ {
if $disp($mol) {molinfo $mol set drawn 1}
}
However, that won't set the ag to redraw the s ene so you need to for e a redraw with display
redraw.

13.2 Atom information


Atom sele tion is the primary method to a ess information about the atoms in a mole ule. It
works in two steps. The rst step is to reate a sele tion given the sele tion text, mole ule id, and
optional frame number. This is done by a fun tion alled atomsele t, whi h returns the name of
the new atom sele tion. the se ond step is to use the reated sele tion to a ess the information
about the atoms in the sele tions.
Atom sele tion is implemented as a T l fun tion. The data returned from atomsele t is the
name of the fun tion to use. The name is of the form atomsele t%d where '%d' is a non-negative
number (su h as 'atomsele t0', atomsele t26', ...).
To lear up a few points (even though this is overed elsewhere), the "mole ule identi er" is a
non-negative integer whi h uniquely identi es one of the loaded mole ules. Ea h mole ule gets a
new number when it is loaded, and the numbers are generated in numeri order. Thus, the rst
mole ule loaded has a mole ule id of 0, the se ond of 1, and so on. To see the mole ule id, open
the "Mole ule" window and look for the number to the right of the olon ( ":" ). This has been
padded with zeros to make it a 3 digit number, so mole ule id 0 is expressed as 000. The id an
also be the word "top", whi h indi ates the top mole ule.
The "sele tion text" is the same as the sele tion language used in the Graphi s form [x 3.3.4℄
and des ribed in Chapter x7. It is used to pi k a given subset of the atom. The text annot be

141
hanged on e a sele tion is made. Some of the terms in the sele tion depend on data that hange
during a traje tory (so far only the keywords 'x', 'y', and 'z' an hange over time). For these,
the optional 'frame value' is used to determine whi h spe i frame to use. The frame number an
be a non-negative integer, the word "now" (the urrent frame), the word " rst" (for frame 0) and
"last" (for the last frame).
In terms of usage, the form of the atom sele tion ommand is:
 atomsele t mole ule id sele tion text [frame frame number℄
Some examples are:
vmd> atomsele t top "name CA"
atomsele t0
vmd> atomsele t 3 "resid 25" frame last
atomsele t1
vmd> atomsele t top "within 5 of resname LYR" frame 23
atomsele t2
The name returned is a fun tion name, and you an use it like any other fun tions. There are
several parameters to these, as shown in the following:
# Number of atoms in the sele tion
vmd> atomsele t1 num
13
# The sele tion text used to reate the sele tion
vmd> atomsele t1 text
{resid 25}
# list of atom indi ies in the sele tion
vmd> atomsele t0 list
0 5 11 17 23 29 35 41 47 53 59 65
The "resid 25" is in bra es be ause it is one element of a T l list. This is an important point to
noti e, for reasons to be dis ussed after multiple attributes are introdu ed.
The way to use the fun tion reated by the atomsele t ommand is to store the name into a
variable, then use the variable to get the name when needed.
vmd> set sel [atomsele t top "water"℄
atomsele t3
vmd> $sel text
water
This is equivalent to saying
vmd> atomsele t3 text
The easiest way of thinking about this is that the atomsele t ommand reates an obje t.
To get information from the obje t you have to send it a ommand. Thus, in the example above
(atomsele t1 num) the obje t "atomsele t1" was sent the ommand "num", whi h asks the obje t
to return the number of atoms in the sele tion.
These derived obje t fun tions (the ones with names like atomsele t3) take many options. They
are listed in Table 13.2.

142
You already saw some examples of the rst few of these ommands. The se ond half of the
ommands allows you to get or set atom information. The information that an be returned are
the same keywords available in the sele tion ommand (eg, "resid", "x", "segname") as well as the
boolean words like "water" and "ba kbone" (these are returned as 1 if true and 0 if false).
For instan e, given the sele tion
vmd> set sel [atomsele t top "resid 4"℄
atomsele t4
you an get the atom names for ea h of the atoms in the sele tion with
vmd> $sel get name
{N} {H} {CA} {CB} {C} {O}
(whi h, remember, is the same as
vmd> atomsele t4 get name
)
Multiple attributes an be requested by submitting a list, so if you want to see whi h atoms are
on the ba kbone,
vmd> $sel get {name ba kbone}
{N 1} {H 0} {CA 1} {CB 0} {C 1} {O 1}
and the atom oordinates with
vmd> $sel get {x y z}
{0.710000 4.211000 1.093000} {-0.026000 3.700000 0.697000} {0.541000
4.841000 2.388000} {-0.809000 4.462000 2.976000} {1.591000 4.371000
3.381000} {2.212000 5.167000 4.085000}
It is very important to note that the information returned by one of these ommands is a list
of lists. Spe i ally, it is a list of size n where ea h element is itself a list of size i, where n is the
number of atoms in the sele tion and i is the number of attributes requested.
One qui k fun tion you an build with the oordinates is a method to al ulate the geometri al
enter (not quite the enter of mass; that's a bit harder). This also uses some of the ve tor
ommands dis ussed in the se tion about ve tors and matri es [x11℄, but you should be able to
gure them out from ontext.
pro geom_ enter {sele tion} {
# set the geometri al enter to 0
set g [ve zero℄
# [$sele tion get {x y z}℄ returns a list of {x y z}
# values (one per atoms) so get ea h term one by one
forea h oord [$sele tion get {x y z}℄ {
# sum up the oordinates
set g [ve add $g $ oord℄
}
# and s ale by the inverse of the number of atoms
return [ve s ale [expr 1.0 /[$sele tion num℄℄ $g ℄
}

143
With that de ned you an say (assuming $sel was reated with the previous atomsele tion
example)
vmd> geom_ enter $sel
0.703168 4.45868 2.43667
I'll go through the example line by line. The fun tion is named geom enter and takes one param-
eter, the name of the sele tion. The rst line sets the variable \g " to the zero ve tor, whi h is 0 0
0. On the se ond line of ode, two things o ur. First, the ommand
$sele tion get {x y z}
is exe uted, and the string is repla ed with the result, whi h is
{0.710000 4.211000 1.093000} {-0.026000 3.700000 0.697000} {0.541000
4.841000 2.388000} {-0.809000 4.462000 2.976000} {1.591000 4.371000
3.381000} {2.212000 5.167000 4.085000}
This is a list of 6 terms (one for ea h atom in the sele tion), and ea h term is a list of three elements,
the x, y, and z oordinate, in that order.
The "forea h" ommand splits the list into its six terms and goes down the list term by term,
setting the variable " oord" to ea h su essive term. Inside the loop, the value of $ oord is added
to total sum.
The last line returns the geometri al enter of the atoms in the sele tion. Sin e the geometri al
enter is de ned as the sum of the oordinate ve tors divided by the number of elements, and so
far I have only al ulated the sum of ve tors, I need the inverse of the number of elements, whi h
is done with the expression
expr 1.0 / [$sele tion num℄
The de imal in "1.0" is important sin e otherwise T l does integer division. Finally, this value is
used to s ale the sum of the oordinate ve tors (with ve s ale), whi h returns the new value, whi h
is itself returned as the result of the pro edure.
The enter of mass fun tion is slightly harder be ause you have to get the mass as well as
the
P
x, y, Pz values, then break that up into to omponents. The formula for the enter of mass is
i i
m x = mass i

pro enter_of_mass {sele tion} {


# some error he king
if {[$sele tion num℄ <= 0} {
error " enter_of_mass: needs a sele tion with atoms"
}
# set the enter of mass to 0
set om [ve zero℄
# set the total mass to 0
set mass 0
# [$sele tion get {x y z}℄ returns the oordinates {x y z}
# [$sele tion get {mass}℄ returns the masses
# so the following says "for ea h pair of { oordinates} and masses,
# do the omputation ..."

144
forea h oord [$sele tion get {x y z}℄ m [$sele tion get mass℄ {
# sum of the masses
set mass [expr $mass + $m℄
# sum up the produ t of mass and oordinate
set om [ve add $ om [ve s ale $m $ oord℄℄
}
# and s ale by the inverse of the number of atoms
if {$mass == 0} {
error " enter_of_mass: total mass is zero"
}
# The "1.0" an't be "1", sin e otherwise integer division is done
return [ve s ale [expr 1.0/$mass℄ $ om℄
}

vmd> enter_of_mass $sel


Info) 0.912778 4.61792 2.78021

The opposite of "get" is "set". A few of the keywords (most notably, "x", "y", and "z") an be
set to new values. This allows, for instan e, atom oordinates to be hanged, the o upan y values
to be updated, or user for es to be added. Right now the only things that an be hanged are the
oordinates, the beta and o upan y values and user for es.
set sel [atomsele t top "index 5"℄
$sel get {x y z}
{1.450000 0.000000 0.000000}
$set set {x y z} {{1.6 0 0}}
Note that just as the get option returned a list of lists, the set option needs a list of lists, whi h
is why the extra set of urly bra es were need. Again, this must be a list of size n ontaining
elements whi h are a list of size i. The exe eption is if n is 1, the list is dupli ated enough times
so there is one element for ea h atom.
# get two atoms and set their oordinates
set sel [atomsele t top "index 6 7"℄
$sel set {x y z} { {5 0 0} {7.6 5.4 3.2} }
In this ase, the atom with index 6 gets its (x, y, z) values set to 5 0 0 and the atom with index
7 has its oordinates hanged to 7.6 5.4 3.2.
It is possible to move atoms this way by getting the oordinates, hanging them (say by adding
some o set) and repla ing it. Following is a fun tion whi h will do just that:

pro moveby {sel offset} {


set new oords {}
forea h oord [$sel get {x y z}℄ {
lvarpush new oords [ve add $ oord $offset℄
}
$sel set $new oords
}

145
And to use this fun tion (in this ase, to apply an o set of (x y z) = (0.1 -2.8 9) to the sele tion
"$movesel"):
moveby $movesel {0.1 -2.8 9}
However, to simplify matters some options have been added to the sele tion to deal with movements
(these ommands are also implemented in C++ and are mu h faster than the T l versions). These
fun tions are moveby, moveto, and move. The rst two take a position ve tor and the last takes a
transformation matrix.
The rst ommand, moveby, moves ea h of the atoms in the sele tion over by the given ve tor
o set.
$sel moveby {1 -1 3.4}
The se ond, moveto, moves all the atoms in a sele tion to a given oordinate (it would be strange
to use this for a sele tion of more than one atom, but that's allowed). Example:
$sel moveto {-1 1 4.3}
The last of those, move, applies the given transformation matrix to ea h of the atom oordinates.
This is best used for rotating a set of atoms around a given axis, as in
$sel move [trans x by 90℄
whi h rotates the sele tion 90 degrees about the x axis. Of ourse, any transformation matrix may
be used.
A more useful example is the following, whi h rotates the side hain atoms around the CA-CB
bond by 10 degrees.
# get the side hain atoms (CB and onwards)
set side hain [atomsele t top "side hain residue 22"℄
# get the CA oordinates -- ould do next two on one line ...
set CA [atomsele t top "name CA and residue 22"℄
set CA oord [lindex [$CA get {x y z}℄ 0℄
# and get the CB oordinates
set CB [atomsele t top "name CB and residue 22"℄
set CB oord [lindex [$CB get {x y z}℄ 0℄
# apply a transform of 10 degrees about the given bond axis
$side hain move [trans bond $CA oord $CB oord 10 deg℄

13.3 Analysis s ripts


Following are some more examples of routines that ould be used for analysing mole ules. These
are not the best routines to used sin e many of these are implemented with the measure ommand,
whi h alls a mu h faster built-in fun tion.
Get the total mass given a sele tion.
pro total_mass {sele tion} {
set sum 0
forea h mass [$sele tion get mass℄ {

146
set sum [expr $sum + $mass℄
}
return $sum
}
Here's another (slower) way to do the same thing. This works be ause the mass returned from the
sele tion is a list of lists. Putting it inside the quotes of the eval makes it a sequen e of ve tors, so
the ve add ommand will work on it.
pro total_mass1 {sele tion} {
set mass [$sele tion get mass℄
eval "ve add $mass"
}
Find the min and max oordinate values of a given mole ule in the x, y, and z dire tions (see
also the measure ommand 'minmax'). The fun tion takes the mole ule id and returns two ve tors;
the rst ontains the min values and the se ond ontains the max.
pro minmax {molid} {
set sel [atomsele t $molid all℄
set oords [$sel get {x y z}℄
set oord [lvarpop oords℄
lassign $ oord minx miny minz
lassign $ oord maxx maxy maxz
forea h oord $ oords {
lassign $ oord x y z
if {$x < $minx} {set minx $x} else {if {$x > $maxx} {set maxx $x}}
if {$y < $miny} {set miny $y} else {if {$y > $maxy} {set maxy $y}}
if {$z < $minz} {set minz $z} else {if {$z > $maxz} {set maxz $z}}
}
return [list [list $minx $miny $minz℄ [list $maxx $maxy $maxz℄℄
}
Compute the radius of gyration P
for a sele tionP(see also measure rgyr). The square of the
radius of gyration is de ned as i mi (~ri ~r )2 = i mi . This uses the enter of mass fun tion
de ned earlier in this hapter; a faster version would repla e that with measure enter.
pro gyr_radius {sel} {
# make sure this is a proper sele tion and has atoms
if {[$sel num℄ <= 0} {
error "gyr_radius: must have at least one atom in sele tion"
}
# gyration is sqrt( sum((r(i) - r( enter_of_mass))^2) / N)
set om [ enter_of_mass $sel℄
set sum 0
forea h oord [$sel get {x y z}℄ {
set sum [ve add $sum [ve length2 [ve sub $ oord $ om℄℄℄
}
return [expr sqrt($sum / ([$sel num℄ + 0.0))℄
}

147
Applying this to the alanin.pdb oordinate le
vmd > mol load pdb alanin.pdb
vmd > set sel [atomsele t top all℄
vmd > gyr_radius $sel
Info) 5.45443
Compute the rms di eren e of a sele tion between two frames of a traje tory. This takes a
sele tion and the values of the two frames to ompare.
pro frame_rmsd {sele tion frame1 frame2} {
set mol [$sele tion molindex℄
# he k the range
set num [molinfo $mol get numframes℄
if {$frame1 < 0 || $frame1 >= $num || $frame2 < 0 || $frame2 >= $num} {
error "frame_rmsd: frame number out of range"
}
# get the first oordinate set
set sel1 [atomsele t $mol [$sele tion text℄ frame $frame1℄
set oords1 [$sel1 get {x y z}℄
# get the se ond oordinate set
set sel2 [atomsele t $mol [$sele tion text℄ frame $frame2℄
set oords2 [$sel2 get {x y z}℄
# and ompute the rmsd values
set rmsd 0
forea h oord1 $ oords1 oord2 $ oords2 {
set rmsd [expr $rmsd + [ve length2 [ve sub $ oord2 $ oord1℄℄℄
}
# divide by the number of atoms and return the result
return [expr $rmsd / ([$sele tion num℄ + 0.0)℄
}
The following uses the frame rmsd fun tion to list the rmsd of the mole ule over the whole
traje tory, as ompared to the rst frame.
vmd > mol load psf alanin.psf d d alanin.d d
vmd > set sel [atomsele t top all℄
vmd > for {set i 0} {$i < [molinfo top get numframes℄} {in r i} {
? puts [list $i [frame_rmsd $sel $i 0℄℄
? }
0 0.0
1 0.100078
2 0.291405
3 0.523673
....
97 20.0095
98 21.0495
99 21.5747

148
The last example shows how to set the beta eld. This is useful be ause one of the oloring
methods is 'Beta', whi h uses the beta values to olor the mole ule a ording to the urrent olor
s ale. (This an also be done with the o upan y eld.) Thus rede ning the beta values allows you
to olor the mole ules based on your own de nition. One useful example is to olor the mole ule
based on the distan e from a spe i point (for this ase, oloring a poliovirus protomer based on
its distan e to the enter of the virus (0, 0, 0) helps bring out the surfa e features).
pro beta olor_distan e {$sel point} {
set newbeta {}
# get the oordinates
forea h oord [$sel get {x y z}℄ {
# get the distan e and put it in the "newbeta" list
set dist [ve length2 [ve sub $ oord $point℄℄
lvarpush newbeta $dist
}
# set the beta term
$sel set beta $newbeta
}
And here's one way to use it:

# load pdb2plv.ent using anonymous ftp to the PDB


# (this assumes the url_get program was set up orre tly (see ...)
vmd > mol pdbload 2plv
vmd > set sel [atomsele t top all℄
vmd > beta olor_distan e $sel {0 0 0}

Then go to the graphi s menu and set the 'Coloring Method' to 'Beta'.

149
Keyword Aliases Arg Set Des ription
id int N mole ular id
index int N index on the mole ule list
numatoms int N number of atoms
sour e str N one of File, Graphi s, Remote, or Sigma
name str N the name of the mole ule (usually the name of the le)
lename str N full lename (if two les, the topology le)
letype str N orresponding le type (PSF, PDB, XYZ, ...)
lename2 str N full lename of oordinate le (if two les)
letype2 str N orresponding le type (DCD or PDB)
a tive bool Y is/make the mole ule a tive
drawn displayed bool Y is/make the mole ule drawn
xed bool Y is/make the mole ule xed
top bool Y is/make the mole ule top
enter ve tor Y get/set the oordinate used as the enter
enter matrix matrix Y get/set the entering matrix
rotate matrix matrix Y get/set the rotation matrix
s ale matrix matrix Y get/set the s aling matrix
global matrix matrix Y get/set the global (rotation/s aling) matrix
view matrix matrix N get/set the overall viewing matrix
numreps int N the number of representations
sele tion i string N the string for the i'th sele tion
rep i string N the string for the i'th representation
olor i olour string N the string for the i'th oloring method
numframes int N number of animation frames
frame int Y urrent frame number
bond oat N the bond energy (for the urrent frame)
angle oat N the angle energy
dihedral oat N the dihedral energy
improper oat N the improper energy
vdw oat N the van der Waal energy
ele trostati ele oat N the ele trostati energy
hbond oat N the hydrogen bond energy
kineti oat N the total kineti energy
potential oat N the total potential energy
energy oat N the total energy
temperature temp oat N the overall temperature

Table 13.1: molinfo keywords

150
Option Des ription
num return the number of atoms in the sele tion
list return a list of the atom indi ies in the sele tion (BTW, this is the same as "get index")
text return the text used to reate this sele tion
molid returns the mole ule id used to reate this
type returns the string 'atomsele t'
delete delete this obje t (removes the fun tion)
global moves the obje t into the global namespa ee
uplevel moves the obje t to another level
get given a list of attributes, return the list ontaining the list of attribute values (see
examples)
set the omplimentary fun tions ( urrently only works for a few terms)
move move the sele tion by a a 4x4 tranformation matrix
moveby move all the atoms by a given o set
lmoveby move ea h atom by an o set given in the list
moveto move all the atoms to a given lo ation
lmoveto move ea h atom to a point given by the appropriate list element
writepdb write the sele ted atoms in a pdb le

Table 13.2: atomsele t keywords

151
Chapter 14

Tips and Tri ks


This hapter is a \how to" olle tion of some of the various ways to use VMD in di erent situations.

14.1 Customizing the Popup Menu and the Hot Keys


When the mouse is in the graphi s display window, you an perform ommands by sele ting items
from the VMD popup menu (a essed by pressing the right mouse button), and by using keyboard
hot keys. This se tion des ribes how to ustomize the popup menu and hot keys to your individual
preferen e.

14.1.1 Customizing the popup menu


The popup menu in VMD has a number of default menu items and submenus, whi h annot be
hanged. These are des ribed in an earlier se tion x 3.1. But you an add new submenus and items
to this menu, and assign text ommands to those items. When the items are sele ted by the user,
the assigned text ommand will be exe uted as if it had been typed in at the onsole. In fa t, with
T l you an assign arbitrarily omplex ommands (su h as s ripts) to a single menu sele tion.
To add a menu to the main pop-up menu, use:
 user add menu name
where name is the name of the menu entry as it will appear in the Popup menu.
For example, lets suppose we want to make a menu of our most often used stru tures. Then the
ommand to a omplish this is:
user add menu Favorites
Sin e there isn't anything in the menu, it doesn't appear in the popup menu yet. To add items to
the menu, use:
 user add subitem menu name ommand
where ommand an either be a list of T l ommands to exe ute or the name of a s ript that is to be
pro essed when the menu item is hosen. For instan e, we often load the stru tures \alanin.pdb"
and \brH.pdb" and remotely download the 9pti stru ture from the PDB FTP site, so we'll add:

152
user add subitem Favorites BPTI {mol pdbload 9pti}
user add subitem Favorites alanin {mol load pdb alanin.pdb}
user add subitem Favorites bR {mol load pdb brH.pdb}
Enter these three lines and then bring up the popup menu. You should see the new menu item
just above the \Help" lines. Unless you also happen to have these mole ules available, the last two
items probably won't work, but the rst one should. Try it out.
You an also add a separator in the menu, using:
 user add subseparator menu
So if you wanted a separation between the rst three mole ules and a fourth, say the poliovirus
2PLV stru ture, then you would type:
user add subseparator Favorites
user add subitem Favorites Polio {mol pdbload 2plv}
As a se ond omplete example, the ode below will produ e a as ading menu whi h allows you
to qui kly adjust the degree of transparen y for transparenent objets (i.e. the default is .3, where
1.0 is opaque and 0.0 is invisible).
# Set the alpha value of the "transparent" materials
pro set_transparen y_value {alpha} {
display update off
# hange the opaqui ity of the transparent olors
for {set olor 17} {$ olor < 34} {in r olor} {
olor hange alpha $ olor $alpha
}
# and the transparent olor s ale (66 to 97)
for {set olor 66} {$ olor < 98} {in r olor} {
olor hange alpha $ olor $alpha
}
display update on
}
user add menu Transparen y
for {set i 1.0} {$i >= 0.0} {set i [expr $i - 0.1℄} {
eval "user add subitem Transparen y $i {
set_transparen y_value $i}"
}

Unfortunately, the user modi able popup menus are not hierar hi al. There is no way to add a
submenu to one of your own menus. They an only be added to the main popup menu. However,
there is another pla e to add new menu items, the `User Commands' submenu of the main menu.
\Where is it?" you ask? It doesn't ontain anything, so it isn't displayed. You an add items to it
just as you an to the main menu, but the ommands are slightly di erent. Admittedly this is not
an optimal solution. Future versions of VMD will use Tk menus to alleviate this problem. Until
then though, here is a spe i ation of the syntax.
To add an item to the `User Commands' menu:
 user add item name ommand
153
To add a separator to the 'User Commands' menu:
 user add separator
The usage is the same as their related ommands, so we won't give a detailed example, but to see
how it works, try this:
# Turn off the axis
user add item {Axes Off} axes lo ation off
user add item {Axes On} axes lo ation LowerLeft
# a break
user add separator
# delete all the loaded mole ule
user add item {Zap Everything} {
forea h mole ule [molinfo list℄ {
mol delete $mole ule
}
}
Finally, if you wish to see the urrent de nitions of the user- ustomized menu items, use the
ommand
 user print menus
This will print out to the onsole the names and asso iated text ommands for all menu items
added by the user.

14.1.2 Customizing the Hot Keys


In a similar fashion, VMD keeps a list of user hot keys, whi h when pressed will result in an
asso iated text ommand being exe uted as if it had been typed at the onsole. There are a
number of prede ned hot keys, as listed in tables 3.1, 3.2, 3.3, and 3.4. The urrent state of these
an be printed out with the ommand
 user print keys
And in the same fashion as for the popup menu, the ommands atta hed to these hot keys an be
ustomized by the user.
To add/modify a hot key, use the ommand
 user add key key ommand
key must be a single hara ter. When that key is pressed while the mouse ursor is in the graphi s
display window, the asso iated ommand will be exe uted.

14.1.3 Automati ally loading ustomization ommands


On e you have dis overed a set of ommands whi h are parti ularly useful and familiar for you,
you will want to have these popup menu ommands and hot key ommands automati ally available
every time you run VMD. This an be done by pla ing the ommands to add these items in your
.vmdr le, whi h is a le ontaining VMD text ommands that is exe uted every time VMD starts
up. The basi method for setting up this le is des ribed in se tion x17.3.4. On e you have su h
a le, just put the user add ommands in it, and you will have your own spe ialized version of
VMD.

154
14.2 Using VMD as a WWW Client (for hemi al/* do uments)
Mosai , Nets ape, and possibly other browsers an be on gured to use VMD as a helper appli ation
for viewing some hemi al/* do uments.

14.2.1 MIME types


When a web browser re eives a do ument from a server it a tually gets two pie es of information:
the header and the body. The header ontains information about the message and body. One of
the most important pie es of data, alled the MIME type spe i es what the body of text des ribes.
For instan e, a GIF image is given the MIME type of image/gif, a JPEG image is image/jpg,
and posts ript is appli ation/posts ript. A lass of types, hemi al/*, has been reated for
hemi al models so the MIME type for PDB les is hemi al/pdb, for XYZ is hemi al/xyz, et .

Helper Appli ations


The web browser uses the MIME type to determine how to view the body of the message. Some of
the do uments are viewed by the browser itself, like text/html whi h des ribes HTML do uments.
In other ases, the browser has to start up another appli ation. From here on, we'll des ribe how
Mosai and Nets ape do this. First, it saves the in oming message body to a temporary le. It
then s ans the global and lo al mail ap les to determine whi h appli ation is used to view the
given MIME type. The appli ation, whi h must take a le name on the ommand line, is then
exe uted. When the appli ation exits, the temporary le is deleted.

14.2.2 Setting up your .mail ap


In the VMD installation dire tory ($VMDDIR/s ripts/vmd/) there is a perl s ript alled hemi-
al2vmd whi h will reate a VMD ommand le. Sin e
then start VMD with the -e ommand line option to read that le. The le ontains the
ne essary ommands to onvert
It is also possible to install the previous s ript in the global .mail ap le to make it a essible
to everyone. You will have to onsult the do umentation for your web browser(s) to nd out how.

14.2.3 Example sites


Some web sites that send hemi al/pdb types are the Protein Data Bank at http://www.r sb.org/
and \Mole ules R US" at http://www.nih.gov/htbin/pdb.

14.3 Making a Movie


It is possible to make movies with VMD, though the interfa e is not well developed. This se tion
is not written for the asual user!
The following T l s ript uses the mpeg en oder available from ftp. s.berkeley.edu, the image
onverter toppm, and su essive Raster3D runs (though it is possible to do s reen grabs as well)
to make a movie of a spinning mole ule. The s ript rotates the system 35 times by 10 degrees
ea h time. For ea h orientation, it saves the image as a Raster3D input le, runs Raster3D on
it to get an RGB raster image, then onverts the RGB le to a ppm graphi s le for use by the
mpeg en oder. On e all the les are made, the mpeg is reated. The temporary les are saved in

155
./images and the full pro ess ould take up a lot of disk spa e, depending on the size of the VMD
graphi s window. This s ript does not automati ally delete the les or the dire tory.
The en oder input le is given after the T l s ript.
VMD s ript to make a movie of a rotating system
for { set i 0 } { $i < 360 } { set i [ expr $i + 1 ℄ } {
render Raster3D out.r3d
at h { exe render < out.r3d -sgi out.rgb }
# get the right format for the number (only works up to 99)
if { $i < 1 } {
set nm "00"
} elseif { $i < 10 } {
set nm "0$i"
} else {
set nm $i
}
# onvert from RGB to PPM
at h { exe toppm out.rgb $nm.ppm }
# delete the RGB file
at h { exe rm out.r3d out.rgb }
# and rotate by 10 degrees
rot y by 10
}
# now make the mpeg
at h { exe mpeg_en ode-1.3.sgi.bin mpeg.input }
The mpeg en oder s ript follows, but be areful as we guessed at most of the values.
PATTERN I
OUTPUT spin.mpg
INPUT_DIR .
INPUT
*.ppm [00-89℄
END_INPUT
BASE_FILE_FORMAT PPM
INPUT_CONVERT at *
GOP_SIZE 4
SLICES_PER_FRAME 2
PIXEL FULL
RANGE 5
PSEARCH_ALG LOGARITHMIC
BSEARCH_ALG SIMPLE
IQSCALE 1
PQSCALE 1
BQSCALE 1
REFERENCE_FRAME DECODED
You would use this by rst loading a mole ule, hanging to the dire tory you wish to use to
store the image les, and entering the ommand

156
play <T l s ript filename>
It does work. Honest.

14.4 Coloring Tri k - Override a Coloring Category


There is urrently no user-de ned oloring method. This makes it hard to olor residues by property
\X" if X is not already de ned in VMD. It is possible to get around this limitation somewhat by
overriding one of the values in the PDB or PSF. For instan e, suppose you wanted to olor the
atoms by the distan e of the atom from a given point. One way is to ompute the distan e and
put it in either the o upan y or beta eld of the PDB le. Then when the mole ule is olored by
o upan y it is a tually oloring by distan e.
You ould also override, say, the segment name eld or even the residue name. Don't override
the atom name unless you are really desperate as VMD uses it to determine whi h residues are
proteins and nu lei a ids, and hen e whi h residues an be drawn as a tube or ribbon.

14.5 Some Ni e Represenations


The following views are quite ni e for displaying proteins and nu lei a ids:

sele tion: all


drawing method: tube
oloring method: segname (or hain)
why? This show the ba kbone of the protein and nu lei a id strands

sele tion: protein and (name CA or not ba kbone)


drawing method: lines
oloring method: segname (or hain)
why? shows where the side hains are lo ated, but they are thin so the
ba kbone is still visible and the s ene is qui kly drawn

sele tion: (numbonds = 0) and not waters


drawing method: vdw
oloring method: name
why? shows ions. The "not waters" omits ases where a water's oxygen is
known but not the hydrogen.

sele tion: not (waters or protein or nu lei )


drawing method: lines
oloring method: name
why? shows whatever is left; usually ligands and rystallizing agents

14.6 Finding Conta t Residues


Suppose you want to view the atoms in \A" whi h are in onta t with \B". Use the within
<distan e> of <sele tion> sele tion ommand. For purposes of demonstration, let A be protein,

157
B be nu lei , and de ne onta t as an atom in A whi h is within 2 
A of an atom in B. Then the
sele tion ommand is
protein within 2 of nu lei
If you want to see all the residues of A whi h have at least one atom in onta t with B, use
same residue as (protein within 2 of nu lei )

14.7 T l Logging
Every issued ommand whi h hanges the state of VMD (loading a mole ule, rotation, opening a
form, et .) an be saved to a le via the log ommand. In addition, if the T l ommand vmdlog
exists, it is alled with the issued ommand as its only term. One use for this is to lter out some
of the ommands.
One pra ti al use of this feature is to lter out the menu ommands so they don't onstantly
disappear and reappear on playba k. In addition, this adds wait ommand if the time between
su esive ommands was more than a se ond so the playba k will emulate the timings of original
a tions.
# set things up to re ord ommands to the file ``session_log.vmd''
pro start_re ording {} {
global re ording_fileid
set re ording_fileid [open session_log.vmd w℄
}

# set up the vmdlog pro

pro vmdlog s {
if {[regexp {^menu } $s℄ != 1} {
global re ording_fileid
global re ording_time
set now [get lo k℄
set delay [expr $now - $re ording_time℄
if {$delay > 1} {
puts $re ording_fileid "wait $delay"
}
puts $re ording_fileid $s
flush $re ording_fileid
set re ording_time $now
}
}

pro stop_re ording {} {


global re ording_fileid
unset re ording_fileid -1
rename vmdlog {}
}

158
14.8 Remote Control of VMD
As part of our resear h on developing new types of user interfa es for mole ular modelling, we have
added a simple way for other programs to send information to a VMD pro ess via the T l-DP RPC
me hanism. (See se tions x 3.4.1 and x10.3.9). As an example of use, here's how to ontrol one
VMD session from another program.
For now, I'll assume that both programs are on the same omputer. Start VMD and exe ute
external on. This tells VMD to start listening for ommands from one of the ma hine ports. (For
those interested in the details, this fun tion disables a eptan e of ommands from other ma hines
( dp_Host -; dp_Host +[exe hostname℄) then starts the server as dp MakeRPCServer 8639.)
SECURITY WARNING: On e the external option is enabled, VMD will allow any program to
onne t to it and exe ute a T l s ript as you. By default, VMD limits its onne tions to other
pro esses on the same ma hine, so you are reasonably safe if you trust the other users. However,
it is easy to modify the settings to allow anyone in the world to onne t and do whatever they
wanted. It is possible to make the onne tion more se ure, but sin e VMD is designed for an
a ademi environment where di erent users trust ea h other, we have not implemented it. (See the
T l-DP distribution for do umentation of how to do so.)
Start up another program that uses T l-DP, like dpwish or another instan e of VMD. (Remem-
ber, you an start VMD without a display with vmd -dispdev none.) Exe ute the ommand
set vmd_server [dp_MakeRPCClient [exe hostname℄ 8639℄
This should return a name like \ le7" if su essful. To send a ommand (in this ase, rotate x by 90)
to VMD, enter
dp_RPC $vmd_server rotate x by 90
To simplify matters you might want to implement a new pro edure to handle these messages
pro tell_vmd {args} {
global vmd_server
dp_RPC $vmd_server eval $args
}
tell_vmd rotate x by 90
Where the last line is an example of how this pro edure is used.
If you want to ontrol VMD on from ma hine, on the ontrolling pro ess, repla e the [exe
hostname℄ with the name of the ma hine with VMD.

14.9 Controlling One VMD With Another


The previous example showed how to ontrol VMD from another pro ess and the one before that
showed how to get a ess to all the VMD display ommmands. These an be ombined to have
one instan e of VMD ontrol another. Here's how.
On the VMD to be ontrolled (on the ma hine named foo), allow external ommuni ations by
exe uting external on. On the ontrolling VMD enter these lines:
external onne t foo
pro vmdlog s {
external send $s
}

159
Chapter 15

Intera tive Mole ular Dynami s


VMD has the apability to work with a mole ular dynami s program running on another omputer,
in order to display the results of a simulation as they are al ulated; we refer to this apability as
Intera tive Mole ular Dynami s (IMD). As new atomi oordinates are generated by the simulation
pro ess, they an be transferred dire tly over the network to VMD, whi h an then animate the
mole ule. A major feature in VMD is the ability to add perturbative steering for es to a running
simulation, whi h are in orporated dire tly into the dynami s al ulation.
In order for VMD to work in this fashion as a graphi al front end and ontrol onsole for a
remote mole ular dynami s simulation, it is ne essary to have a version of a mole ular dynami s
program on gured for IMD ommuni ation. The program NAMD, developed the the University
of Illinois Theoreti al Biophysi s Group, will support IMD beginning with release 2.1. See the
NAMD WWW home page1 for information on obtaining a opy of NAMD. NAMD is a parallel
mole ular dynami s program written in C++, whi h implements the CHARMM energy fun tion.
It is ompatible with X-PLOR style PSF, PDB, and parameter les. The rest of the dis ussion in
this hapter assumes you are using NAMD.

15.1 How the Conne tion Works


IMD works by establishing a TCP onne tion between VMD and NAMD. NAMD, or whi hever
mole ular dynami s program is being used, a ts as the server. In order to prepare NAMD to a ept
VMD's onne tion request, NAMD must be instru ted at the time the program starts to listen for
in oming onne tions on a parti ular port. On e NAMD has started up, it will wait for the user
to onne t through VMD through that port. VMD and NAMD perform a handshake sequen e to
determine things su h as the relative endianness of the ma hines, then the simulation ommen es.
Before onne ting to the remote simulation, the VMD user must rst load a mole ule orre-
sponding to the system being simulated. This an be done within the Load Files form by sele ting
"IMD" as the mole ule type, then hoosing a psf and pdb le for loading. It is not ne essary
that the oordinates in the pdb le bear any relation to the simulation oordinates, sin e they will
immediately be repla ed when VMD starts re eiving oordinates from NAMD. However, the psf
le should be the same le used in the NAMD on guration le. The pdb and psf les an also be
loaded at the ommand line in the VMD onsole, using the ommand "mol load imd <psÆle> pdb
<pdb le>". Note that a mole ule must be loaded in one of these two ways for a onne tion to be
established.
1
http://www.ks.uiu .edu/Resear h/namd/

160
On e the mole ule is loaded and NAMD has been started and is listening for a onne tion, the
user is ready to onne t to the simulation and start re eiving oordinates. To establish a onne tion,
type the following at the ommand line: "imd onne t <host> <port>". <host> is the name of the
ma hine on whi h NAMD started; if NAMD is running on several distributed nodes, VMD must
onne t to the root node on whi h NAMD initially started out.
VMD an onne t to only one mole ular dynami s simulation at a time. To pause, deta h, or
kill a running simulation, see the Sim Form se tion 3.3.12.

161
Chapter 16

Advan ed S ript Writing


The biggest improvement in VMD 1.1 has been the addition of ommands for analyzing atomi
and mole ular information. This hapter des ribes through examples how to put those ommands
together to write s ripts. We assume at this point you already read through the other hapters
whi h des ribe the various ommands, in luding:
 how to use T l (see Chapter x10)
 whi h ommands are/are not \ ore" ommands (see se tion x10.3)
 the T l ve tor and matrix extensions (see Chapter x11)
 the atomsele t, molinfo, and olinfo ommands (see Chapter x 13 and se tion x10.3.4)
The examples used will not be des ribed in detail, but will only explain some of the more
unusual or novel features of the VMD s ripting language. The sour e of the examples an be found
in the VMD s ript library at http://www.ks.uiu .edu/Resear h/vmd/s ript_library/.
Many of these s ripts use the tra e ommand from T l. This does not mean all good s ripts
must use that ommand, but rather that putting a tra e on a variable is a ni e way to add an
automati a tion.

16.1 Drawing a distan e matrix


This example reates a distan e matrix made of the distan e between the CAs of two residues. The
only input value is sele tion used to nd the CAs. The distan es are stored in the 2D array \dist",
whi h is indexed by the atom indi es of the CAs (remember, atom indi es start at 0).
The distan e matrix is a new graphi s mole ule. It onsists of two triangles for ea h element
of the matrix (to make up a square). The olor for ea h pair is one of the 32 elements in the olor
s ale and is determined so the range of distan e values ts linearly between 34 and 66 (ex luding 66
itself). The name of the graphi s is \CA distan e(n)" where \n" is the mole ule id of the sele tion
used to reate the matrix.
The rst graphi s ommand, \materials o " is to keep the lights from re e ting o the matrix
(otherwise there is too mu h glare). At the end, the orners of the matrix are labeled in yellow
with the resid values of the CAs.
One extra pro edure, \ve dist", is reated. This omputes the di eren e between two ve tors
of length 3. It is not as general as the normal method (ve norm [ve sub $v1 $v2℄) but is almost

162
twi e as fast, whi h speeds up the overall subroutine by almost 10%. The s ript is not very fast;
after all, for a 234 residue protein, 27495 distan e al ulations are made and 54756*2 triangles
generated. Nearly all of that is done in T l. In terms of times, about 1/3 is spent in the distan e
al ulations, another 1/3 in the math to make the triangles, and another 1/3 in the three \graphi s"
alls. The residue 234 example protein took 70 se onds to do everything on a Crimson.
Example usage:
mol load pdb $env(VMDDIR)/proteins/alanin.pdb
set sel [atomsele t top all℄
a_distan e $sel

# Input: two ve tors of length three (v1 and v2)


# Returns: ||v2-v1||
pro ve dist {v1 v2} {
lassign $v1 x1 x2 x3
lassign $v2 y1 y2 y3
return [expr sqrt(pow($x1-$y1,2) + pow($x2-$y2,2) + pow($x3-$y3, 2))℄
}

\index{atom! oordinates}
\index{atomsele t! ommand}
# Input: a sele tion
# Does: finds the CAs in the sele tion then omputes and draws the
# CA-CA distan e grid with olors based on the olor s ale
# Returns: the id of the new graphi s mole ule ontaining the grid
pro a_distan e {main_sel} {
# get the CA atoms from the sele tion
set mol [$main_sel molindex℄
set sel [atomsele t $mol "$main_sel and name CA"℄

# find distan es between ea h pair


set oords [$sel get {x y z}℄
set max 0
set list2 [$sel list℄

forea h atom1 $ oords id1 [$sel list℄ {


forea h atom2 $ oords id2 $list2 {
set dist($id1,$id2) [ve dist $atom2 $atom1℄
set dist($id2,$id1) $dist($id1,$id2)
set max [max $max $dist($id1,$id2)℄
}
lvarpop list2
lvarpop oords
}

163
# draw the pretty graphi
puts "Distan es al ulated, now drawing the distan e map ..."
mol load graphi s "CA_distan e($mol)"
set gmol [molinfo top℄
# turn material hara teristi s off
graphi s $gmol materials off
# i1 and j1 are i+1 and j+1; this speeds up onstru tion of x{01}{01}
set i 0
set i1 1
# preset the s aling fa tor (31.95 instead of 32 ensures there will be
# no olor 66 (for the max olor), whi h is transparent)
set s ale [expr 31.95 / ($max + 0.)℄
set list2 [$sel list℄
forea h id1 [$sel list℄ {
set j 0
set j1 1
set x00 "$i $j 0"
set x10 "$i1 $j 0"
set x11 "$i1 $j1 0"
set x01 "$i $j1 0"
forea h id2 $list2 {
set ol [expr int($s ale * $dist($id1,$id2)) + 34℄
graphi s $gmol olor $ ol
graphi s $gmol triangle $x00 $x10 $x11
graphi s $gmol triangle $x00 $x11 $x01
in r j
in r j1
set x00 $x01
set x10 $x11
set x11 "$i1 $j1 0"
set x01 "$i $j1 0"
}
in r i
in r i1
}
# put some numbers down to give an idea of what is where
set resids [$sel get resid℄
set num [llength $resids℄
set start [lindex $resids 0℄
set end [lindex $resids [expr $num - 1℄℄
graphi s $gmol olor yellow
graphi s $gmol text "0 0 0" "$start,$start"
graphi s $gmol text "$num 0 0" "$end,$start"
graphi s $gmol text "0 $num 0" "$start,$end"
graphi s $gmol text "$num $num 0" "$end,$end"
return $gmol

164
}

16.2 Analysis of PDB les


The VMD atom sele tion ommands were prototypes in two in-house programs developed previ-
ously, pdblang, whi h showed the need for an easy-to-use language for manipulating stru tures,
and parse whi h tested the usefulness of T l for analyzing large numbers of stru tures.
Spe i ally, the goal of the se ond proje t was to nd what features were needed to write a
s ript to analyze the propensity of various residues to be lo ated near metal ions. Su h a s ript
would need to do the following:
 given a list of representative PDB les, get them from the PDB
 nd if a metal ion is present
 nd the residues within 3, 5, and 7 
A from the ion
 keep tra k of the results
The hardest part of the s ript is determining if a metal ion is present, as it is hard to distinguish
between a CA al ium and a CA alpha arbon. That still hasn't been solved, though the method
below should work for nearly all ases, ex ept when ions are inadvertently bonded to other atoms.
The new PDB de nition has a new eld for element type, but VMD does not yet re ognize it.
There are several un ommon methods used here. They are des ribed in the omment statements.
Note that this uses the 'pdbload' ommand to ftp the stru ture les dire tly from the PDB ftp site.

# adds the given (floating point) value to the value


# if the value doesn't exist, sets it to 0
# This pro edure is used be ause "in r" fails if the variable doesn't exist
pro myin r {var val} {
regexp {^[^(℄*} $var prefix
global $prefix
if {![info exists $var℄} {
set $var 0
}
set $var [eval "expr $var + $val"℄
}

# given the atom index, find the ions within the given distan e
# return
pro find_nearby_residues {index ion distan e} {
set nearby [atomsele t top "(within $distan e of index $index) \
and not index $index"℄

# I need to ount ea h residue on e, but I need to distinguish


# two su essive residues, so using just the residue name is not
# enough. "resname residue" is unique and, sin e atoms on the

165
# same residue have su essive indi es, the luniq gets just one
# of them.
forea h res_pair [luniq [$nearby get {resname residue}℄℄ {
lassign $res_pair resname
myin r ount($ion,$distan e,$resname) 1
}
}

pro analyze_ion_propensity {pdblist metals} {


global ount
# get ea h of the entries from the list of PDB files
forea h entry $pdblist {
# load them from the PDB ftp site
mol pdbload $entry
# go through the sear h list of metal names
forea h ion $metals {
set sel [atomsele t top "name $ion and numbonds == 0"℄
forea h atom [$sel list℄ {
# find neighbors for ea h of the test ranges
find_nearby_residues $atom $ion 3
find_nearby_residues $atom $ion 5
find_nearby_residues $atom $ion 7
}
# save memory spa e by for ing the deletion of the
# temporary sele tion. (Otherwise they wouldn't be purged
# until the end of the pro edure.)
$sel delete
}
mol delete top
}
# the array `` ount'' ontains the data in the form
# (ion name,distan e,residue name)
# For now just print the values for the normal residues within
# 7A of a Zn. Use a histogram of '*'
set resnames {ALA ARG ASN ASP CYS GLN GLU GLY HIS ILE LEU LYS MET \
PHE PRO SER THR TRP TYR VAL}
forea h resname $resnames {
puts -nonewline "$resname :"
myin r ount(ZN,7,$resname) 0
puts [repli ate * $ ount(ZN,7,$resname)℄
}
}

For the example, the les 1TRZ, 1LND, and 1EZM ontain zin s.
vmd> unset ount

166
vmd> analyze_ion_propensity {1trz 1lnd 1ezm} ZN
ALA :****
ARG :***
ASN :****
ASP :***
CYS :**
GLN :
GLU :******
GLY :
HIS :***********
ILE :
LEU :*
LYS :**
MET :
PHE :*
PRO :
SER :****
THR :
TRP :
TYR :***
VAL :****

As expe ted, histidines were one of the most ommon zin neighbors. Of ourse, there will still
be problems of missampling (for instan e, over ounting mole ules with zin nger dimers) so you
should be very sure of what you are doing when using this type of automated analysis.

16.3 save/load VMD state information


One of the more frequently requested options is the ability to save the urrent state of VMD to a
le so it an be re overed. It is possible to log the ore ommands to a le and play them ba k later,
and re onstru t everything that way. However, that is quite umbersome and slow, so a better way
is needed.
Be ause we are making mu h of the VMD data a essible at the T l s ript level, we de ided
to implement the save/restore option as a T l ommand. This is a tually a rather ompli ated
pro ess and some of the things to wat h out for are:
 A loaded mole ule ould be from a oordinate le or a oordinate and a topology le
 The mole ule ould have been onverted with Babel
 The mole ule ould be a \graphi s" mole ule (see Chapter x12)
 Ea h mole ule has a list of sele tions, olors, and drawing methods
 The mapping of a olor ategory item to olor an be hanged
 Color de nitions an be rede ned
 Ea h mole ule has its own viewing matrix

167
 Loading a new mole ule resets all the viewing matri es
Ivo Hofa ker has gra iously struggled through all the above aveats to write a set of T l om-
mands whi h will save nearly all of the urrent VMD state to a le, and restore it ba k again. The
ommands are
 save state le name { saves the vmd state in the form of a s ript in le le name. Restarting
vmd as vmd -e le name should restore most of the previous session. Essentially everything
that an be hanged from the graphi s and mol and olor forms will be saved, but nothing
else. In parti ular, the s ript will restore:
{ mole ules read in from les
{ graphi s obje ts (spheres, ylinders...)
{ all representations
{ the transformation matri es for ea h mole ule
{ whi h olor to use for whi h representation, de nitions of olors 0..33
It will not restore:
{ traje tories loaded via the edit menu
{ labels
{ intera tive MD sessions
{ anything in the display form, su h as lighting, axes, stage, ...
 save viewpoint { saves the enter, rotation, s aling and global matri es (in this order) in
a global variable viewpoints
 restore viewpoint { restores the viewpoint saved in variable viewpoints
 save reps { saves the urrent mole ule(s) representations in a global array representations.
 restore reps { repla es urrent representations by the representations stored in the global
array representations. Note, that save reps saves mole ule Ids along with the representa-
tions, so if the molId of a urrently loaded mole ule is di erent from that saved, this ommand
will not work properly.
 save olors le des riptor { writes olor de nitions to a le spe i ed by a le des riptor.
This le an later be sour ed to restore the de nitions. To save the olor de nitions, the
following pro edure an be used.
# save the olor definitions in a file
# argument: file name
pro sav ol {file} {
save_ olors [open $file w℄
lose $filedes
}
This pro edure takes the le name as a parameter (as opposed to le des riptor in save olors).
If you plan to write s ripts whi h intera t with VMD itself (not just the analysis ommands), you
are highly advised to look at the ommands, whi h are de ned in $VMDDIR/s ripts/vmd/save state.t l
(The ode is too long to be in luded in this se tion.)

168
16.4 Currently pi ked mole ule/atom
Every time an atom is pi ked, the T l variables vmd pi k mol and vmd pi k atom are set to the
mole ule id and atom index of the pi ked atom. This is useful for s ripts that need to a t on used
de ned atom.
For example, the following pro edure takes the pi ked atom and nds the mole ular weight of
residue it is on.
pro mol_weight {} {
# use the pi ked atom's index and mole ule id
global vmd_pi k_atom vmd_pi k_mol
set sel [atomsele t $vmd_pi k_mol "same residue as index $vmd_pi k_atom"℄
set mass 0
forea h m [$sel get mass℄ {
set mass [expr $mass + $m℄
}
# get residue name and id
set atom [atomsele t $vmd_pi k_mol "index $vmd_pi k_atom"℄
lassign [$atom get {resname resid}℄ resname resid
# print the result
puts "Mass of $resname $resid = $mass"
}
On e an atom has been pi ked, run the ommand mol weight to get output like:
Mass of ALA 7 : 67.047

16.5 Tra e on the pi k variables


T l has the \tra e" ommand whi h registers a pro edure to be alled when a variable is read,
hanged, or deleted. (Please see one of the various T l books for examples on how to use this.)
Sin e VMD sets the vmd pi k atom and vmd pi k mol variables, they an be tra ed.

16.5.1 Information about the pi ked atom


As a simple example, the following pro edure alls the \mol weight" ommand (in the previous
se tion).
pro mol_weight_tra e_f tn {args} {
mol_weight
}
(This fun tion is needed be ause the fun tions registered with tra e take three arguments, but
\mol weight" only takes one.)
The tra e fun tion is registered as:
tra e variable vmd_pi k_atom w mol_weight_tra e_f tn
And now the residue masses will be printed automati ally when an atom is pi ked. To turn this
o ,
tra e vdelete vmd_pi k_atom w mol_weight_tra e_f tn

169
16.5.2 Making a sphere appear when an atom is pi ked
Similarly, you an use the allba k to generate a sphere when an atom is pi ked.

pro pi k_sphere {args} {


global vmd_pi k_atom vmd_pi k_mol
# get the oordinates
lassign [[atomsele t $vmd_pi k_mol "index $vmd_pi k_atom"℄ \
get {x y z}℄ x y z
# draw the sphere
draw sphere "$x $y $z" radius 1
}

and establish the tra e:

tra e variable vmd_pi k_atom w pi k_sphere

Whenever you li k on an atom, a sphere will appear at the same lo ation. Sin e the graphi s
and the mole ule aren't the same graphi s obje t, you may need to reset view to make them aligned.
To turn the tra e o :

tra e vdelete vmd_pi k_atom w pi k_sphere

16.5.3 Drawing a line from the eye to the pi ked atom


This last example of a tra e on the pi ked atom draws a line from the pi ked atom to the user's eye.
It is a good example of how to use matri es in VMD. The limitation to the following pro edure is
that it doesn't understand perspe tive viewing, so to make it work, use the orthographi mode.
This was used to nd the dire tion to pull a ligand from its bound position out of the protein.
The mole ule was rotated until the user ould look straight down to the ligand. The user then
pi ked an atom on the ligand, ausing a line (a tually, a ylinder) to be drawn from the atom past
the eye lo ation, and the start and end points of the ylinder were printed for later use.

pro eye_line {} {
global vmd_pi k_atom vmd_pi k_mol
set sel [atomsele t $vmd_pi k_mol "index $vmd_pi k_atom"℄

# oordinates of the atom


set oords [lindex [$sel get {x y z}℄ 0℄

# position in world spa e


set mat [lindex [molinfo $vmd_pi k_mol get view_matrix℄ 0℄
set world [ve trans $mat $ oords℄

# sin e this is orthographi , just get the proje tion on z


lassign $world x y
# get a oordinate behind the eye
set world2 "$x $y 5"

170
# onvert ba k to mole ule spa e
# (need an inverse, whi h is only available with the
# measure ommand)
set inv [measure inverse $mat℄
set oords2 [ve trans $inv $world2℄

# and draw the line


draw ylinder $ oords $ oords2 radius 0.3

puts "Start: $ oords"


puts "End: $ oords2"
}

16.6 Traje tory frames


This se tion shows examples of how to use vmd frame($mole ule) and vmd timestep($mole ule).
They both depend on traje tory information, but one is set during playba k of an animation while
the other is set only when a new oordinate set has been re eived from the remote simulation.

16.6.1 Animating the se ondary stru ture


The se ondary stru ture de nitions for the mole ules in VMD don't hange during an animation
but they an be made to do so with a tra e on the vmd frame($mole ule) T l variable. The
simplest way is to all vmd al ulate stru ture(mole ule) every time the frame hanges, e.g.,

pro stru ture_tra e {name index op} {


vmd_ al ulate_stru ture $index
}

tra e variable vmd_frame w stru ture_tra e

but this isn't the fastest solution for a ouple of reasons. First o , the se ondary stru ture ode
is somewhat slow (and about 2/3 of the time is spent in the T l interfa e; mostly in writing a
temporary PDB le). If you don't plan to modify the oordinates, it is possible to store, or a he,
the se ondary stru ture from one frame to the next. Se ond, if there are multiple mole ules loaded
and animated, the se ondary stru tures of all of them are omputed.
The following s ript, ss a he (for \se ondary stru ture a he") addresses those two problems.
It is turned on with the ommand start ss a he followed by the mole ule number of the mole ule
whose se ondary stru ture should be saved (the default is \top", whi h gets onverted to the orre t
mole ule index). Whenever the frame for that mole ule hanges, the pro edure ss a he is alled.
ss a he is the heart of the s ript. It he ks if a se ondary stru ture de nition for the given
mole ule number and frame already exists in the T l array ss a he data(mole ule,frame). If so,
it uses the data to rede ne the \stru ture" keyword values (but only for the protein residues). If
not, it alls the se ondary stru ture routine to evaluate the se ondary stru ture based on the new
oordinates. The results are saved in the ss a he data array.

171
On e the se ondary stru ture values are saved, the mole ule an be animated rather qui kly
and the updates an be ontrolled by the animate form.
To turn o the tra e, use the ommand stop ss a he, whi h also takes the mole ule number.
There must be one stop ss a he for ea h start ss a he. The ommand lear ss a he resets
the saved se ondary stru ture data for all the mole ules and all the frames.

# Ca he se ondary stru ture information for a given mole ule

# reset the se ondary stru ture data a he


pro reset_ss a he {{molid top}} {
global ss a he_data
if {! [string ompare $molid top℄} {
set molid [molinfo top℄
}
if [info exists ss a he_data($molid)℄ {
unset ss a he_data
}
}

# start the a he for a given mole ule


pro start_ss a he {{molid top}} {
if {! [string ompare $molid top℄} {
set molid [molinfo top℄
}
global vmd_frame
# set a tra e to dete t when an animation frame hanges
tra e variable vmd_frame($molid) w ss a he
return
}

# remove the tra e (need one stop for every start)


pro stop_ss a he {{molid top}} {
if {! [string ompare $molid top℄} {
set molid [molinfo top℄
}
global vmd_frame
tra e vdelete vmd_frame($molid) w ss a he
return
}

# when the frame hanges, tra e alls this fun tion


pro ss a he {name index op} {
# name == vmd_frame
# index == mole ule id of the newly hanged frame
# op == w

172
global ss a he_data

# get the protein CA atoms


set sel [atomsele t $index "protein name CA"℄

## get the new frame number


# T l doesn't yet have it, but VMD does ...
set frame [molinfo $index get frame℄

# see if the ss data exists in the a he


if [info exists ss a he_data($index,$frame)℄ {
$sel set stru ture $ss a he_data($index,$frame)
return
}

# doesn't exist, so (re) al ulate it


vmd_ al ulate_stru ture $index
# save the data for next time
set ss a he_data($index,$frame) [$sel get stru ture℄

return
}

16.6.2 Viewing sele tions whi h hange during an animation


One of the resear hers here needed a way to see whi h waters bridged between a protein and a
nu lei a id during a traje tory. The spe i waters hange during the simulation, so the stati
method used in the graphi s form doesn't work. Instead, the vmd frame variable and a a hing
method similar to the ss a he of the previous se tion was used for the following solution:
The a he data is stored in the array bridging waters. Unlike ss a he, this array is indexed
only by the frame number; you'll have to modify it to analyze multiple hanging sele tions.
When the frame number hanges, the a he is he ked and, if no data exists, the sele tion is
rebuilt. Sin e the sele tion is reated in a pro edure, it must be given by the global ommand to
make it exist outside that pro edure's ontext.
The global T l variable bridging is set to the sele tion for this frame.
The rst text sele tion in the graphi s form is set to bridging. This is one of the spe ial
extensions to the sele tion language whi h enable the sele tions to referen e a T l variable. Note
also that the display updates are temporarily turned o . This is used to keep the display from
being drawn an additional time by the all to mol modsele t. This is done every time the frame
hanges sin e that's the only way to tell VMD the graphi s have hanged; for ing it to re al ulate
that representation's display.

# start the tra e


pro start_bridging {{molid top}} {
global vmd_frame bridging_mole ule
if {![string ompare $molid top℄} {
set molid [molinfo top℄

173
}
tra e variable vmd_frame($molid) w al _bridging
set bridging_mole ule $molid
}

# stop the tra e


pro stop_bridging {} {
global bridging_mole ule vmd_frame
tra e vdelete vmd_frame($bridging_mole ule) w al _bridging
}

# do the a tual al ulation


pro al _bridging {args} {
global bridging_waters bridging_mole ule bridging
# get the urrent frame number
set frame [molinfo $bridging_mole ule get frame℄

# has the sele tion already been made?


if {! [info exists bridging_waters($frame)℄} {
puts "Cal ulating frame $frame for $bridging_mole ule"
set bridging_waters($frame) [atomsele t $bridging_mole ule
{(water within 4 of segname DNA) and (water within 4 of segname PRO1)}
frame $frame℄
}
# set things up for the graphi s form to use the pre omputed sele tion
set bridging $bridging_waters($frame)
# do this sin e otherwise the sele tion is deleted when the pro ends
$bridging global
# update the 0th element of the graphi s mole ule
# Note: if the display wasn't turned off, there would be an extra
# update of the animation ... very bad
display update off
mol modsele t 0 $bridging_mole ule {bridging}
display update on
}

Sin e the sele tions are available in the global s ope, you an analyze the results at any time.
This simple fun tion prints how many atoms are in ea h sele tion of the a he.

pro num_bridging {} {
global bridging_waters
set nums [lsort -integer [array names bridging_waters℄℄
forea h num $nums {
set num_atoms [$bridging_waters($num) num℄
puts "Frame $num has $num_atoms atoms"
}

174
}

It would be ni e to hange the text sele tion used, support multiple sele tions, have the \"
variables in more ompli ated expressions in the graphi s sele tions, and be able to use this s ript
for multiple mole ules. These are left to the student as an exer ise :).

16.6.3 Simulation frames


When a new simulation timestep arrives, the T l variable vmd timestep(mole ule) is set to the
value of the new frame. You guessed it { this an be used along with the tra e ommand.
One simple ase prints the temperature of the new timestep.
pro timestep_temp_tra e {name id op} {
set temp [molinfo $id get temperature℄
puts "Temp. of mole ule $id is $temp"
}

tra e variable vmd_timestep w timestep_temp_tra e

Of ourse, why do textually what you an do graphi ally? The following makes a plot of the
last ten temperatures. For simpli ity, only one plot is allowed.
The begin temp plot sets up the temperature plot variables and alls the tra e. The tra e
alls timestep temp tra e whi h adds the new temperature to the storage list and then alls the
graphi s routine. (A list was used here be ause, while slower than an array, the lvarpop was handy.)
There is nothing new or unusual about the plotting pro edure (draw temps plot) or the routine
to nish the real-time plotting (end temp plot).
pro begin_temp_plot {molid} {
# make sure the mole ule exists
molinfo $molid get frame

global temps temps_mol temps_tra e_mol vmd_timestep


# reate a new graphi s mole ule
mol load graphi s "Temp.of_$molid"
set temps_mol [molinfo top℄
set temps [ldup 10 0℄
# the mole ule to wat h
set temps_tra e_mol $molid
# start the tra e
tra e variable vmd_timestep($molid) w timestep_temp_tra e
}

pro end_temp_plot {} {
global temps_tra e_mol
# remove the tra e
tra e vdelete vmd_timestep($temps_tra e_mol) w timestep_temp_tra e
}

175
pro draw_temps_plot {} {
global temps temps_mol
graphi s $temps_mol delete all
graphi s $temps_mol olor red
set tmp $temps
set pt0 [lvarpop tmp℄
set x0 0
set x1 10
forea h pt1 $tmp {
graphi s $temps_mol line "$x0 $pt0 0" "$x1 $pt1 0"
set x0 $x1
in r x1 10
set pt0 $pt1
}
graphi s $temps_mol olor green
graphi s $temps_mol line {0 0 0} {100 0 0}
graphi s $temps_mol line {0 0 0} {0 500 0}
}

pro timestep_temp_tra e {args} {


global temps temps_mol temps_tra e_mol
# delete old and add newest value to temps
lvarpop temps
set new_t [molinfo $temps_tra e_mol get temp℄
set temps "$temps $new_t"
draw_temps_plot
}

Needless to say, many more options an be added to this for plotting di erent variables, au-
tos aling, adding text, et .
By the way, though it has not yet been tested out, we envision that a tra e on the vmd timestep
variable ould be used to modify the user for es as the simulation progresses. This makes the linear
for e ontrols emulate a harmoni well, or let you apply the for es along a path. You ould even
make two atoms ome towards ea h other, or draw apply the for es to the atoms on a sele tion
su h that the enter of mass of the sele tion is the important term. If you want to try it out, good
lu k!

16.7 RMSD and best- t alignments


Cal ulation of RMSD and best- t alignment of two sets of atoms using the mouse ontrols were
des ribed in se tion x3.1.1. The same a tions an be taken on the s ripting level. Text interfa e
also gives you more exibility through the atom sele tion me hanism allowing to hoose the atoms
to t/ ompare.

176
16.7.1 RMSD Computation
There are two atom sele tions needed to do an RMSD omputation, the list of atoms to ompare
in both mole ules. The rst atom of the rst sele tion is ompared to the rst atom of the se ond
sele tion, fth to fth, and so on. The a tual order is identi al to the order from the input PDB
le.
On e the two sele tions are made, the RMSD al ulation is a matter of alling the measure
rmsd fun tion. Here's an example:
set sel1 [atomsele t 0 "ba kbone"℄
set sel2 [atomsele t 1 "ba kbone"℄
measure rmsd $sel1 $sel2
Info) 10.403014
This prints the RMSD between the ba kbone atoms of mole ule 0 with those of mole ule 1.
You ould also use a weighting fa tor in these al ulations. The best way to understand how to do
this is to see another example:
set weighted_rmsd [measure rmsd $sel1 $sel2 weight mass℄
Info) 10.403022
In this ase, the weight is determined by the mass of ea h atom. A tually, the term is really
one of the standard keywords available to an atom sele tion. Other ones in lude index and resid
(whi h would both be rather strange to use) as well as harge, beta and o upan y. These last
terms useful if you want to spe ify your own values for the weighting fa tors.

16.7.2 Computing the Alignment


The best- t alignment is done in two steps. The rst is to ompute the 4  4 matrix transformation
that takes one set of oordinates onto the other. This is done with the measure fit ommand.
Assuming the same sele tions as before:
set transformation_matrix [measure fit $sel1 $sel2℄
Info) {0.971188 0.00716391 0.238206 -13.2877}
{0.0188176 0.994122 -0.106619 3.25415} {-0.23757 0.108029 0.965345 -2.97617}
{0.0 0.0 0.0 1.0}
As with the RMSD al ulation, you ould also add an optional weight <keyword> term on the
end.
The next step is to apply the matrix to a set of atoms using the move ommand. So far you have
two oordinate sets. You might think you ould do something like $sel1 move $transformation matrix
to apply the matrix to all the atoms of that sele tion. You ould, but that's not the right sele tion.
The thing to re all is that $sel1 is the sele tion for the ba kbone atoms. You really want to
move the whole fragment to whi h it is atta hed, or even the whole mole ule. (This is where the
dis ussion earlier omes into play.) So you need to make a third sele tion ontaining all the atoms
whi h are to be moved, and apply the transformation to those atoms.
# mole ule 0 is the same mole ule used for $sel1
set move_sel [atomsele t 0 "all"℄
$move_sel move $transformation_matrix

177
As a more ompli ated example, with the mouse you annot do something like "align all of
mole ule 1 with mole ule 9 using only the ba kbone atoms of residues 4 to 10 in both systems"
with the mouse. However, you an do it with the text ommand. Here's how:
# ompute the transformation matrix
set referen e_sel [atomsele t 9 "ba kbone and resid 4 to 10"℄
set omparison_sel [atomsele t 1 "ba kbone and resid 4 to 10"℄
set transformation_mat [measure fit $ omparison_sel $referen e_sel℄

# apply it to all of the mole ule 1


set move_sel [atomsele t 1 "all"℄
$move_sel move $transformation_mat

16.7.3 A simulation example s ript


Here's a longer s ript whi h you might nd useful. The problem is to ompute the RMSD between
ea h timestep of the simulation and the rst frame. Usually in a simulation there is no initial
global velo ity, so the enter of mass doesn't move, but be ause of angular rotations and be ause
of numeri al impre isions that slowly build up, the s ript aligns the mole ule before omputing its
RMSD.
# Prints the RMSD of the protein atoms between ea h timestep
# and the first timestep for the given mole ule id (default: top)
pro print_rmsd_through_time {{mol top}} {
# use frame 0 for the referen e
set referen e [atomsele t $mol "protein" frame 0℄
# the frame being ompared
set ompare [atomsele t $mol "protein"℄

set num_steps [molinfo $mol get numframes℄


for {set frame 0} {$frame < $num_steps} {in r frame} {
# get the orre t frame
$ ompare frame $frame

# ompute the transformation


set trans_mat [measure fit $ ompare $referen e℄
# do the alignment
$ ompare move $trans_mat
# ompute the RMSD
set rmsd [measure rmsd $ ompare $referen e℄
# print the RMSD
puts "RMSD of $frame is $rmsd"
}
}
To use this, load a mole ule with an animation (for example, $VMDDIR/proteins/alanin.DCD
from the VMD distribution). Then run print rmsd through time. Example output is shown here:
vmd > print_rmsd_through_time

178
RMSD of 0 is 0.000000
RMSD of 1 is 1.060704
RMSD of 2 is 0.977208
RMSD of 3 is 0.881330
RMSD of 4 is 0.795466
RMSD of 5 is 0.676938
RMSD of 6 is 0.563725
RMSD of 7 is 0.423108
RMSD of 8 is 0.335384
RMSD of 9 is 0.488800
RMSD of 10 is 0.675662
RMSD of 11 is 0.749352
[...℄
If you wanted you ould do all sorts of things, like graph this value through time.

179
Chapter 17

Customizing VMD Sessions


There are a number of ways to hange the behavior of VMD from the default settings, both in how
the program starts up and in how the program behaves during a session. This Chapter des ribes
the data les, ommand-line options, and environment variables whi h are used to ustomize a
VMD session.
These les ontrol the initial appearan e and behavior of VMD at the start, and may be
ustomized to suit ea h user's parti ular tastes. Default versions of these les are pla ed in the VMD
installation dire tory (usually /usr/lo al/lib/vmd). Ea h user may spe ify their own versions of
some of these les, but unless this is done the ommands and values in the default les are used. In
this way, an administrator may ustomize the default behavior of VMD for all users, while giving
ea h user the option to hange the default behavior however they hoose.
Several on gurable parameters may also be set in a number of ways, in luding use of ommand-
line options or environment variables. The order of pre eden e of these methods is as follows
(highest pre eden e to lowest):

1. Command-line options.
2. Environment variable settings.
3. Values spe i ed in the initialization le (.vmd init, se tion 17.3.3).
4. Built-in defaults, as spe i ed by ompilation on gurable parameters. These are used only
if no other values are spe i ed by the other methods mentioned in this list. The Installation
Guide des ribes how to hange these default values when ompiling VMD.

17.1 Command-Line Options


When started, the following ommand-line options may be given to VMD. Note that if a ommand-
line option does not start with a dash (-), and is not part of another option, it is assumed to be a
PDB lename. Thus, the ommand
vmd mole ule.pdb
will start VMD and load a mole ule from the le mole ule.pdb.

 -h | -? : Print a summary a ommand-line options to the onsole.

180
 -e filename : After initialization, exe ute the text ommands in lename, and then resume
normal operation.
 -psf filename : Load the spe i ed mole ule (in PSF format) at startup. The PSF le only
ontains the mole ular stru ture; a PDB or DCD le must also be spe i ed when this option
is used.
 -pdb filename : Load the spe i ed mole ule (in PDB format) at startup.
 -d d filename : Load the spe i ed traje tory le (in binary DCD format) at startup. The
DCD le only ontains atomi oordinates; a PDB or PSF le must also be spe i ed when
this option is used.
 -dispdev < win | text | ave | aveforms | none > : Spe ify the type of graphi al
display to use. The possible display devi es in lude:
{ win: a standard graphi s display window.
{ text: do not provide any graphi s display window.
{ ave: use the CAVE virtual environment for display, forms are disabled.
{ aveforms: use the CAVE virtual environment for display and with forms enabled. This
is useful with -display ma hine:0 for remote display of the forms when the CAVE uses
the lo al s reen.
{ none: same as text.
It is possible to use VMD as a lter to onvert oordinate les into rendered images, by using
the -dispdev text and -e options.
 -dist z : Spe ify the distan e to the VMD image plane.
 -height y : Spe ify the height of the VMD image plane.
 -pos x y : Spe ify the position for the graphi s display window. The position (x,y) is the
number of pixels from the lower-left orner of the display to the lower-left orner of the
graphi s window.
 -size x y : Spe ify the size for the graphi s display window, in pixels.
 -nt : Do not display the VMD title at startup.
 -startup filename : Use lename as the VMD startup ommand s ript, instead of the
default .vmdr le.
 -debug [level : Turn on output of debugging messages, and optionally set the urrent debug
level (1=few messages ... 5=many verbose messages). Note this is only useful if VMD has
been ompiled with debugging option in luded.

181
17.2 Environment Variables
Several environment variables are used by VMD to determine the lo ation of ertain les and
dire tories. These variables are a essible to text interfa e through array env. These variables
in lude:

 VMDDIR : The dire tory whi h ontains the VMD data les (su h as this help le) and
ar hite ture-spe i exe utables. By default, this is /usr/lo al/lib/vmd.
 VMDTMPDIR : The dire tory whi h VMD should use for temporary data les. By default, this
is /tmp.
 VMDBABELBIN : The omplete path and lename for the program babel, whi h is used by
VMD to onvert mole ular stru ture/ oordinates les into PDB les whi h VMD an a tually
understand. If this is not set expli itly, the VMD startup s ript will attempt to nd babel in
the urrent path. If Babel annot be found or is not installed, VMD will not be able to read
mole ular le formats other than PDB, PSF, and binary DCD les.
 VMDCAVEMEM : This overrides the default size of the shared memory arena whi h is allo ated
by VMD when the CAVE starts up. The variable must be an integer number of megabytes.
Sin e this is the only shared memory pool allo ated, and it is done only on e, you must
hoose a value suÆ ient to a ount for the largest s ene you intend to render in VMD in
that CAVE session. The default value unless otherwise spe i ed is 80 Megabytes. Values
of 200MB to 512MB are ommonly needed for large mole ular systems ontaining several
hundred thousand atoms.
 VMDHTMLVIEWER : The name of the HTML viewer (Nets ape, Mosai , whatever you prefer)
that VMD should use to display HTML do uments (su h as this help le). By default, this
is Nets ape.
 VMDIMAGEVIEWER : The name of the external program to use for displaying VMD snapshots
(or other images), in various formats.
 VMDSCRDIST : Distan e to the VMD image plane.
 VMDSCRHEIGHT : Height of the VMD image plane.
 VMDSCRPOS : Position of the VMD graphi s window (x,y).
 VMDSCRSIZE : Size of the VMD graphi s window (x,y).
 VMDSNAPSHOT : The name of the external program to use for taking snapshots (s reen apture)
of VMD graphi s window.

17.3 Startup Files


17.3.1 Core S ript Files
In the following, the value of $VMDDIR is the vmd installation dire tory. During the original in-
stallation this is the value of INSTALLLIBDIR. It an also be found by looking at the rst few lines

182
of the vmd startup s ript (head `whi h vmd`) or by starting VMD and using the ommand set
env(VMDDIR).
As mentioned elsewhere, VMD uses the T l interpreter with two language extensions, T lX
and T l-DP. Ea h of these three pa kages reads T l s ripts at initialization, whi h are ontained in
VMD distribution; with a di erent dire tory for ea h pa kage. The lo ations of the dire tories is
determined by the environment variables de ned in the vmd s ript. In order they are TCL LIBRARY,
TCLX LIBRARY, and DP LIBRARY, whi h are set in the vmd startup s ript to $VMDDIR/s ripts/t l,
$VMDDIR/s ripts/t lX, and $VMDDIR/s ripts/dp, respe tively. In addition, VMD has its own
dire tory of ore T l routines.
The most important of these is tt $VMDDIR/s ripts/vmd/vmdinit.t l. This le sets up the
basi T l initialization ommands in luding the ommands that at h Ctrl-C interrupts, de ne
some environment variables, and add the vmd s ript dire tory to the T l autoindex path. Most of
the other les are referen ed through the auto path.
There are a few non-T l s ripts in this dire tory. Currently these are perl s ripts used for the
urlload ommand and web lient startup (see se tion x 10.3.16 and se tion x14.2).

17.3.2 User S ript Files


Two user on guration les are available: an initialization le .vmd init, and a run-time ommand
le .vmdr with a list of initial VMD text ommands to pro ess. These les may be hanged to
ustomize individual user's initial s reen appearan e and to set the proper display hara teristi s
for displaying in stereo. If they do not exist, default values are used.

17.3.3 .vmd init File


This le is used to de ne several on guration variables whi h must be set before several key obje ts
(e.g., the display devi e) an be reated. (This is a tually a limitation of the VMD implementation
| future versions will not use this le.) Thus this is the rst le read by VMD; before even the vm-
dinit.t l le. VMD sear hes for this le in three lo ations; $VMDDIR/.vmd init, $HOME/.vmd init,
and ./.vmd init. Ea h opy of the le found will be read in and pro essed in that order. This
allows the administrator to establish a omplete set of default values for all users, and then for ea h
user to sele tively hange the settings required without having to set ALL parameters.
The lines in the initialization le should be either blank lines, omment lines (beginning with
the # hara ter), or parameter setting lines of the form
<keyword> = <value>
with any amount of whitespa e allowed before and after the equal sign. The possible keywords
that may be entered here are:
 BABEL = < lename>
The name (in luding omplete path) of the babel program exe utable, whi h is used to
onvert various mole ular le formats to PDB les whi h may be read by VMD. See se tion
x4.1 This parameter should not be used; instead, use environment variable VMDBABELBIN (see
se tion x17.2)
 DISPLAY = <WIN | CAVE | TEXT>
The type of display devi e whi h VMD should use initially. This an be set to either WIN,
CAVE, or TEXT. By default, this is WIN. It an be overridden with the -dispdev ommand line
option.

183
 HTMLVIEWER = < lename>
The name of the HTML browser whi h should be used to display HTML les (su h as the
VMD on-line help le). Typi al examples are Mosai or Nets ape; by default this is Nets ape.
 SCRDIST = <value>
The distan e, in `world' oordinates, from the origin to the display s reen. If this is zero,
the origin of the oordinate system in whi h mole ules are drawn oin ides with the enter
of the display. If it is < 0, the origin is lo ated between the viewer and the s reen, while if
it is > 0, the s reen is lo ated loser to the viewer than the origin. A value < 0 puts any
stereo image in front of the s reen, aiding the three-dimensional e e t; a value > 0 results in
a stereo image that is behind the s reen, a less dramati (but easier to see, for some people)
stereo e e t when stereo display is used. Figure 3.17 des ribes the relationship between this
parameter and the world oordinate spa e.
 SCRHEIGHT = <value>
This parameter, with SCRDIST, de nes the size and distan e of the display s reen. SCRHEIGHT
is the default value for the s reen height, whi h is the verti al size of the display s reen in
`world' oordinates. Ea h mole ule is initially s aled and translated to t within a 2 x 2 x 2
box entered at the origin; so the height of the s reen helps determine how large the mole ule
appears initially. If VMD is being displayed on a workstation monitor only, it is best not to
hange this value from the default setting. This parameter is used mainly to on gure the
VMD display to the dimensions and position of a large-s reen display, su h as a proje tor,
that may be used as a stereo display. As for SCRDIST, gure 3.17 des ribes the relationship
between this parameter and the world oordinate spa e.
 SCRPOS = <xpos> <ypos>
The position of the lower-left orner of the window used to display images, if the display
type is WIN. Both xpos and ypos are in pixels. If they are not spe i ed, and are not given as
ommand-line options, the window will have to be intera tively pla ed with the mouse.
 SCRSIZE = <xsize> <ysize>
The size of the window used to display images, if the display type is WIN. Both xpos and
ypos are in pixels. If they are not spe i ed, and are not given as ommand-line options, the
window will have to be intera tively sized with the mouse.
 TITLE = <ON | OFF>
A ag indi ating whether to display the VMD title in the main display when the program
starts. This an have the value of ON or OFF. By default, TITLE is set to be ON. If the title is
turned on, it will remain displayed until a mole ule is loaded, after whi h it will be hidden
from view. This an also be set with the ommand line option -nt.
Here is an example of an initialization le:
display = win
title = on
s rheight = 6.0
s rdist = -2.0
s rpos = 596 190
s rsize = 669 834

184
17.3.4 .vmdr File
After everything is initialized, VMD reads the startup le using the equivalent of the ommand play
.vmdr . This le ontains text ommands for VMD to exe ute just as if they had been entered at
the VMD text onsole ommand prompt. The le an ontain any number of ommands, in luding
blank lines and omment lines (whi h begin with the # hara ter). If an error is en ountered while
reading this le, the ommand in error is skipped and pro essing of the le ontinues.
VMD sear hes for this le in three lo ations; ./.vmdr , $HOME/.vmdr and $VMDDIR/.vmdr .
Only the rst le found will be read in and pro essed.
See hapter x 10 for a des ription of the VMD text ommands whi h may be put in this le.
Also, se tion x 14.1 dis usses how to put ommands into the .vmdr le to ustomize the behavior
of the popup menu and hot keys.
Here is an example of a startup le:
# add personalized keyboard short uts
user add key E e ho on
user add key e e ho off
user add key g display reset
user add key A stage lo ation bottom
user add key m mol list

# position the stage and axes


axes lo ation lowerleft
stage lo ation off

# position and turn on menus


menu main move 5 196
menu display move 386 90
menu animate move 124 7
menu edit move 125 196
menu graphi s move 5 455
menu files move 5 496
menu mol move 5 745

menu main on

# start the s ene a-ro kin'


ro k y by 1

185
Chapter 18

Future Plans
Following is a list of features we would like to add. They will be implemented as they are needed,
but some will not be done until the next major version.
 Improve PDB reader to read multiple models and the new "element" eld (see ??? for a
program to onvert CONECT re ords to a PSF le)
 element type based on atom name and residue type, if information isn't given in the PDB
 append and delete spe i atoms
 text for raster outputs
 improve surfa e rendering speeds
 improve sphere rendering speeds
 save more information about urrent setup (see se tion x 16.3 for the s ript ommands to
save the urrent setup)
 standardize nomen lature and usage of keywords and other de nitions
 add more sele tion de nitions, like purine
 expand the ability of the mouse to pi k atoms
 add atom oloring methods
 rewrite the forms using Tk
 faster al ulation of hydrogen bonds
 implement \ orre t" transparen y
 be able to sele t bonds
 draw mole ular and isoele tri surfa es (a la GRASP) ???
 develop the 3D interfa e
 improve the intera tive steering

186
 will need to add a new input/output oordinate le (probably GROMOS) be ause we are
approa hing limits to atom and residue number
 read in the ele tron density maps made by X-PLOR and display isosurfa es ??? get the right
name (based on Joel's omments)
 work on an interfa e to use X-PLOR s ripts as subroutines, perhaps via T l's \expe t"

187
Index
.mail ap, 164 atom
.vmd init, 189 hanging properties, 154
.vmdr , 163, 191 oordinates, 122, 123
eye line, 177 hanging, 21, 154
ss a he, 178 min and max, 156
info, 32, 150
angles, 49 name lists, 43, 45
animate pi king, 20
ommand, 109, 110 sele tion, 18, 19, 33, 67, 84, 150
form, 46 omparison, 88
frames from remote, 59 default, 119
remote simulation, 59 examples, 19, 84
animation, 19, 29, 178 keywords, 34, 45, 84, 92, 93
amount, 48 logi , 86
appending, 48 math fun tions, 94
delete, 48, 111 modes, 84
edit, 47 quoting, 86
goto end, 30, 111 referen es in, 90
goto start, 30, 111 regular expression, 87
hot keys, 37 same, 89
jump, 47, 111 sequen e, 89
movie, 164 text, 151
of se ondary stru ture, 178 within, 89
pause, 30 atoms
play, 29, 30, 110 distan e between, 20
read, 48, 111 plotting, 50
skip, 46 atomsele t
speed, 46, 111 ommand, 147, 150, 172
step, 30 axes, 51
style, 30, 111 ommand, 110, 111
loop, 30, 47
on e, 30, 47 Babel, 64
ro k, 30, 47 beta values, 158
viewing hanges, 180 bonds
with user-de ned graphi s, 142 determining, 65
write, 48, 111 label, 49
animationdupli ate frame, 110 representation, 68
annmm, 90 resolution, 68
antialiasing, 51, 114 unusual, 65

188
button bar, 39 ommand, 79, 110, 113
rosseyes, 26
artoon representation, 68, 72 rystaleyes, 26
enter, 32 devi e, 188
enter of mass, 153 form, 51
lipping planes, 52 left, 27
olor modes, 26
a ess de nitions, 112 NAMD pat hes, 59
assignment, 20 orthographi , 26
ba kground, 53 perspe tive, 26
ategory, 53, 76, 77, 112, 166 right, 27
ommand, 75, 110, 111 sidebyside, 26
form, 20, 53, 75{77 stereo o , 26
id, 45, 75, 112 update, 81, 82, 113, 114, 150, 180
in user-de ned graphi s, 135 distan e
map, 53 matrix, 169
material properties, 135 distan e between atoms, 20
names, 75, 113 dotted van der Waals representation, 68, 70
properties, 75, 113 draw
rede nition, 53, 80, 81, 162 ommand, 134, 145
revert to default, 82 extensions, 145
s ale, 54, 77, 80, 81, 112 drawing
hanging, 54 box around mole ule, 140
transparent, 45, 54, 75, 79, 80, 82, 162 method, 18, 43
olor map, 76 drawn, 41
olorinfo
ommand, 83, 110, 112 e ho
oloring ommand, 110, 114
by ategory, 77 environment variables, 188
by olor s ale, 77, 80 DP LIBRARY, 189
by property, 166 SURF BIN, 72
methods, 18, 34, 43, 67, 75, 76, 79, 118, SURF TMPDIR, 72
119, 166 TCL LIBRARY, 189
ommand line options, 187 TCLX LIBRARY, 189
onta t residues, 166 VMDBABELBIN, 65, 189
opyright, 14 VMDDIR, 189
ore ommands, 63, 109 VMDHTMLVIEWER, 189
CPK, 68 VMDTMPDIR, 65, 189
exit
debug ommand, 110
ommand, 110, 113 external
delete ommand, 62, 110, 115, 168
representation, 34 ontrol of VMD, 168
depth ue, 51, 114 interfa e, 61
depthsort, 79, 114 eye separation, 100, 114
detail, 51, 114
display le

189
browser, 38 grabber, 57
load, 16 graphi s
le types ommand, 134, 143, 169
input, 48, 64 delete, 144
output, 48 form, 43, 76
les loading, 143
initialization, 189 primitives, 134
output, 18 repla e, 144
read, 111 user-de ned, 134
reading, 17, 19, 40, 42, 48, 64, 118, 188 gyration, radius of, 156
startup, 163, 188, 189, 191
writing, 48, 65, 111 hbonds representation, 68, 73
t, 27 help, 31, 40
example, 28 ommand, 110, 115
RMSD, 183, 184 topi s, 116
al ulate, 27 hot keys, 34, 124
print, 28 animation ontrol, 37
two fragments, 28 ustomizing, 163
two mole ules, 28 menu ontrol, 37
at, 51 mouse ontrol, 35
fo al length, 100, 114 rotation and s aling, 36
form hydrogen bonds, 73
animate, 19, 46, 59
info menu, 32
lose, 31
olor, 20, 53, 75{77 label
display, 24, 51 ommand, 110, 115
edit animation, 47 labels, 20, 29
les, 16, 42 ategories, 49, 116
graphi s, 18, 19, 43, 76, 79 delete, 29, 50
hot keys, 37 delete all, 29
label, 26, 49 form, 49
main, 16, 39 hide, 29, 50
mole ules, 16, 19, 40 pi king with mouse, 24
open, 31 plotting, 50
remote, 41, 57 show, 29, 50
render, 18, 54 text, 141
sim, 59 li ori e representation, 68, 71
tra ker, 56 light
forms, 117 ommand, 110, 116
frame ontrolling with mouse, 24
delete, 48, 111 toggle, 52
dupli ate, 110 line width, 44, 134
write, 111 lines representation, 67, 68
frames, 41 log le
full detail, 51 ommand, 110, 117
logging t l ommands, 114, 117, 124, 167, 174
geometri enter, 152

190
mass ommand, 147
enter of, 153 keywords, 159
of residue atoms, 176 setting values with, 149
total, 155 mouse
material properties, 135 ommand, 110, 119
matrix routine, 128 modes, 17, 20, 23, 35, 119
trans, 130 using, 22
transaxis, 129 movies, 164
transidentity, 128 MSMS
transmult, 129 representation, 68, 73
transo set, 130
transtranspose, 129 NAMD, 58, 102
transve , 129 namd, 11, 123
transve inv, 130 namd onsumer, 103
MDComm, 11, 58, 102 namdd, 103
MDS ope, 11, 60 orthographi view, 52, 98
measure output
ommand, 155, 156 format, 18
menu
ommand, 110, 117 pdbload
popup, 17, 20, 23, 80, 110, 124 ommand, 172
ustomizing, 161 perspe tive view, 52, 98
vs forms, 16 pi king, 32, 176
mole ular surfa e, 68, 72, 73 angles, 24, 25
mole ule atoms, 20, 24, 25
a tive, 33, 41, 46 bonds, 20, 24, 25
analysis, 155, 172 enter, 25
best- t alignment, 184 dihedrals, 24, 25
ommand, 110, 118, 119, 149 distan es, 20, 26
data, 159 hot keys, 35
deleting, 42 modes, 20, 24
drawn, 33, 41 move atom, 25
xed, 21, 33, 41 move fragment, 25
graphi s, 143 move mole ule, 26
id, 118, 144, 147, 150 move residue, 25
index, 118, 147 query, 25
info, 147 text ommand, 120
list, 41, 149 tra ing variables, 141, 176
loading, 17, 19, 40, 143, 158 play
remote, 59, 122 ommand, 108, 110, 120, 166, 188
sour e, 148 le, 32
status, 33, 41, 118 plot
hanging, 42, 119, 149 data with graphi s, 137
top, 31, 33, 41, 47, 147 geometry monitors, 50
translation, 21 temperature, 182
molinfo pointer, 57
points

191
detail, 51 stereo, 101
representation, 68, 69 representation, 43, 67, 118
popup menu, 17, 20, 23, 80, 108, 110, 161 add new, 43
atom spe i , 32 hanging, 19, 43, 45, 119
ustomizing, 124 deleting, 44
posts ript, 96, 97 examples, 166
Pov-Ray, 96 info, 148
o , 74
quit, 32, 40 style, 18, 43, 67, 68, 118
ommand, 114, 120 options, 44
quoting, 86 reset view, 31, 114
Radian e, 96 resolution
ylinder, 44
radius
level, 51, 114
of gyration, 156
rapp, 102 sphere, 44
raster image reation, 95 restore
Raster3D, 18, 55, 66, 96, 97, 101, 121, 165 representations, 175
RayShade, 96 viewpoint, 149, 175
vmd state, 174
regular expression, 87, 94
ribbon representation, 68, 71
X-PLOR onversion, 94
remote RMSD, 157, 183{185
ommand, 110, 120 ro k, 30, 47
onne tion, 102, 120 ommand, 110, 121
ontrolling, 59 rotate
ommand, 110, 122
des ription, 103
deta hing, 60 side hain, 155
initializing, 58 rotation
installation, 104 automati , 30
killing, 60 ro k, 31
spin, 30
modi able parameters, 60
stop, 30, 31
requirements, 102
starting, 58 ontinuous, 23
troubleshooting, 106 hot keys, 36
using, 59 stop, 23
form, 57 transformation matrix, 129, 131
using mouse, 23
options, 120
simulation ontrol, 57, 120, 122 save
remote ontrol of VMD, 168 olors, 175
render on guration, 32, 174
ommand, 110, 121 representations, 175
form, 18, 54 viewpoint, 149, 175
rendering, 18, 54, 55, 95 vmd state, 32, 174
aveats, 55, 97 s ale
exe ommand, 121 ommand, 110, 122
in ba kground pro ess, 55 s aling
method, 34, 96, 121 using mouse, 24

192
s reen parameters, 52, 97 tra e representation, 68, 71
se urity, 62, 168 tra ker
sele tion, 18, 19, 43, 67, 118, 150 ommand, 110, 123
omparison, 88 form, 56
keywords, 45, 84, 92 traje tory
boolean, 86 les, 64
logi , 86 read, 48, 188
math fun tions, 94 write, 48
modes, 84 transformation matrix, 128
text, 151 align, 129
short ir uit logi , 86, 89 entering, 131
simulation identity, 128
ommand, 110, 122 o set, 130, 131
ontrol, 57, 122 rotation, 129, 131
form, 59 translate
parameters, 58, 182 ommand, 110, 123
solvent a essible surfa e, 68, 70 translation
solvent representation, 68, 70 hange atom oordinates, 155
sour e transformation matrix, 130
ommand, 108 using mouse, 24
spin, 30 transparen y, 45, 75, 79, 80, 82, 162
stage, 51 tube representation, 68, 71
ommand, 110, 123
startup les, 163, 188, 189, 191 user
stereo ommand, 110, 123, 161
mode, 98 user interfa es, 60
modes, 26 3D, 61
o , 98 external, 61, 109, 115, 168
parameters, 52, 100, 114 forms, 35
problems, 100 gesture, 62
surf spee h, 62
representation, 68, 72 text, 108
surfa e
van der Waals representation, 68, 69
mole ular, 68, 70
variables
solvent a essible, 68, 70
env, 188, 189
surfa e plot, 139
M PI, 132
T l, 109 vmd frame, 178
T l-DP, 62, 109, 168 vmd pi k atom, 141, 176
T lX, 109 vmd pi k mol, 141, 176
text vmd timestep, 178, 182
displayed, 135 ve tor ommand
Tk, 109 oordtrans, 131
top, 31 ve add, 126
topology les, 64 ve ross, 127
tra e ve dot, 127
variables, 141, 178, 182 ve invert, 128

193
ve length, 127
ve length2, 128
ve norm, 128
ve s ale, 127
ve sub, 127
ve trans, 131
ve zero, 126
ve tor routines, 126
view, 43, 67, 118
adding, 44
deleting, 44
viewing modes
hanging, 98
VMD, 11
as a server, 168
as helper appli ation, 164
ommand line options, 187
ompile options, 124
ontrol from another VMD, 168
opyright, 14
ustomizing, 163, 187
vmdinfo
ommand, 110, 124
vmdlog
ommand, 63, 124
VRML, 96
wait
ommand, 110, 124
wireframe, 51, 67

194

You might also like