Back to OMM Exhibits

An Introduction to Jmol* Scripting**
Nathan Silva and David Marcey
© 2020

I. Introduction
II. Display
III. Loading and Positioning
IV. Selecting and Labeling
V. Coloring and Schemes
VI. Illustrating Bonds and Drawing Arrows

VII. Animation / Superpositioning

Separate Page: Constructing Jmol Surfaces

Note: if this tutorial is helpful in the creation of your own webpages, please explicitly acknowledge this in your work (e.g. URL, Author, and, ideally, a link to this page). And please drop an email to marcey@callutheran.edu with a link to your page/s. This helps with funding opportunities for the OMM and helps ensure continued development of this resource. Thanks!

Directions

Please leave comments/suggestions or please acknowledge use of this site by visiting our feedback page

[Back to OMM Exhibits]

Note: surfaces require a lot of memory and are slow to load. This is especially true now that we are using JSmol and HTML5 instead of the java-based Jmol. If you get an unresponsive script, please choose continue. you may need to do this several times, depending on the script.

This exhibit displays molecules in the left part of the screen, and text that addresses structure-function relationships of the molecules in the right part (below). Use the scrollbar to the right to scroll through the text. If you are using browser other than Firefox (the recommended browser for this site), be sure to allow popups. In Chrome, you can click on the popup blocker icon in the right part of the address bar..

To evoke renderings of the molecule that illustrate particular points, click the radio buttons:

** For a comprehensive list of Jmol commands, see the Jmol Interactive Scripting Doc.



I. Introduction

Jmol, a Java applet used to view molecules in web pages, can read scripts that are contained in Jmol buttons. These scripts are used to change the rendering of the molecule to illustrate important structural features.

This exhibit provides example Jmol scripts that can be copied and pasted into the javascript tags for buttons. Each section starts with a discussion of the uses of various renderings and ends with a table that includes a list of buttons (left column - ) containing sample scripts (right column). These evoke particular renderings of the molecules displayed in the left frame. If you are new to Jmol scripting, it is suggested that you spend time going through the exhibit in its entirety, reading the scripts to see how they can be employed in your own web pages.

return to beginning of the exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



II. Display

Jmol uses two different units of measurement that can be used with display commands. One is the standard, atomic-resolution unit, the Angstrom (Å); 1 Å = 10-10 meters. Chime also uses a novel unit, the RasMol unit; 1 RasMol unit = 1/250 Å. The display codes (see below) can be modified to specify dimensions in either RasMol units or Angstroms by adding a numerical value after the name of a command. Angstroms are indicated by a decimal in the numerical value and RasMol units are used as a default when no decimals are employed. For example, a 'wireframe 125' script specifies a wireframe display in 125 RasMol Units. This is equivalent to the script "wireframe 0.5" (0.5 Å).

The default display for most pdbs is wireframe, as shown at left. Wireframe is very useful because it clearly shows the covalent bonds (except S-S bonds) between all atoms of a molecule.

Varying the thickness of wireframe displays can provide useful alternatives in illustrating points.

Spacefill is another commonly used display. Spacefill rendering displays the Van der Waals radius of each atom as a solid sphere by default.

Spacefill radii can be altered by a numerical specification (see below).

Different "ball and stick" representations can be achieved by varying the thickness of wireframe and the radii of spacefill.

Dots is a display similar to spacefill in that the diameter of the spheres formed are equal to that of the Van der Waals radius. Dots combines easily with other display commands to provide useful effects. Combining wireframe and dots displays can show Van der Waals surfaces clearly for a loop or secondary structure.

So far, we have considered displays that affect all atoms of a molecule, unless particular atoms are selected (see below, The Select Command). Sometimes showing only the backbone of a molecule is desired. There are several displays that illustrate the backbone conformation of a molecule:

The backbone display shows the polypeptide backbone of a protein or the sugar-phosphate backbone of a nucleic acid as a train of bonds connecting the adjacent alpha carbons of each amino acid (protein) or phosphorus atoms (nucleic acid) in sequential order.

Trace is a display similar to backbone, but with smoothed transitions between the alpha carbons of a peptide chain or the phosphorus atoms of nucleic acids.

There are two displays that are excellent for showing secondary structure:
ribbons; cartoons. Ribbons smooth the backbone, like trace, but display the backbone as a wide, flattened band. Cartoons does the same except that nucleic acid backbones are displayed as a trace and the nitrogenous bases of nucleic acids are rendered as flat rings. Numerical modifications can be used to change the width of the band. In default mode of both ribbons and cartoons, the width of alpha helical and beta strand secondary structure is greater than that of loops. Cartoon has the feature of indicating amino-carboxy polarity of peptides. This is quite convenient, e.g. when showing the parallel or antiparallel arrangement of beta strands in a beta sheet.

Strands is a rendering similar to ribbons and cartoons, but with the backbones displayed as a series of thin lines. Strands can be indicated with dashed lines (see below).

Rockets and meshribbons are two additional representations of backbone conformations.

Lighting effects can be employed to change the appearance of a molecular display. For example:

Ambient lighting intensity can be manipulated.

Specular highlights on atoms are white reflections of the "light source". The degree of specular highlighting can be changed.

It is sometimes useful to display the surfaces of molecules. For example, the shapes of ligand binding pockets or catalytic sites are often illuminated is a surface view. To learn about Jmol suface displays, consult our SURFACES page.

Sample Display Commands

Buttons/Effects
code for buttons =
<script language="JavaScript" type="text/javascript">
jmolRadio('!quit; zap;Jmol scripts here', "", false );
</script>

relevant Jmol scripts in buttons (the scripts below are often preceded by commands that load molecules and turn off default displays - see NB, below)

Place between ' ' in button code

  wireframe (default thickness) wireframe;

  wireframe 50 (50 RasMol units = 0.2 Å)

wireframe 50;
  wireframe 100 (100 RasMol units = 0.4 Å) wireframe 100;
  wireframe 0.6 (0.6Å = 150 RasMol units) wireframe 0.6;
  spacefill (default = Van der Waals radius) spacefill;
  spacefill 50 (50 RasMol units = 0.2 Å) spacefill 50;
  spacefill 100 (100 RasMol units = 0.4 Å) spacefill 100;
  spacefill 500 (500 RasMol units =2.0 Å) spacefill 500;
  spacefill 0.5 (0.5 Å = 125 RasMol units) spacefill 0.5;
  dots (~100 dots per atom) spacefill off; dots;
  dots wireframe combo wireframe 100; dots;
  backbone (default thickness) backbone;
  backbone 100 (100 RasMol units = 0.4 Å) backbone 100;

  backbone 0.6 (0.6Å = 150 RasMol units)

backbone 0.6;
  trace (default = 90 RasMol units) trace;
  trace 10 (10 RasMol units = 0.04 Å) trace 10;
  trace 50 (50 RasMol units = 0.2 Å) trace 50;
  trace 100 (100 RasMol units = 0.4 Å) trace 100;
  trace 0.6 (0.6Å = 150 RasMol units) trace 0.6;
  ribbon (default thickness) ribbon;
  ribbon 100 (100 RasMol units = 0.4Å) ribbon 100;
  ribbon 250 (250 RasMol units =1.0 Å) ribbon 250;
  ribbon 1.5 (1.5 Å = 375 RasMol units) ribbon 1.5;
  cartoon (default thickness) cartoon;
  cartoon 100 (100 RasMol units = 0.4 Å) cartoon 100;
  cartoon 250 (250 RasMol units =1.0 Å) cartoon 250;
  cartoon 1.5 (1.5 Å = 375 RasMol units) cartoon 1.5;
  strands (default thickness) strands;
  strands 100 (100 RasMol units = 0.4 Å) strands 100;
  strands 250 (250 RasMol units = 1 Å) strands 250;
  3 strands strands; set strands 3;
  6 strands strands; set strands 6;
  ball and stick wireframe 0.15; spacefill 0.45;
  ball and stick small wireframe 30; spacefill 75;
  ball and stick large wireframe 75; spacefill 150;
  rocket cartoons (# between 0.1 and 4.0) rocket 2.5
  meshribbons (# between 0.1 and 4.0) meshribbon 2.5
  low ambient lighting intensity set ambient 5;

  medium ambient lighting intensity

set ambient 40;
  high ambient lighting intensity set ambient 80;
  set low specular highlight intensity set ambient 40; set specpower 5;
  set medium specular highlight intensity set ambient 40; set specpower 40;
  set high specular highlight intensity set ambient 40; set specpower 90;

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



III. Loading and Positioning


Loading a pdb by use of a button is useful for introducing a new molecule into an exhibit or for simply resetting a molecule after it has been manipulated.

N.B.: When constructing a Jmol script for a button in a molecular exhibit, it is helpful to incorporate a series of default commands that turn off any previous scripts invoked by other buttons. We recommend the following set of commands be used upon loading: "set frank off; select all; hbonds off; spin off; wireframe off; spacefill off; trace off; set ambient 40; set specpower 40; slab off; ribbons off; cartoons off; label off; monitor off". This "blank state" can then be modified by subsequent commands in the script.

Once a pdb is loaded it is often useful to orient the molecule in 3-D by rotating it around the X,Y, or Z axes. Rotation commands are expressed in degrees so a rotation of 360 around a particular axis will show no change in the orientation of the molecule.

A molecule can also be translated along any of the axes without rotation:
Translation along the X axis causes the molecule to move left or right. Translation along the Y axis causes the molecule to move up or down. Note: contrary to intuition, positive numbers for Y translation move molecules down and negative numbers move molecules up.
Translation on the Z axis is called zoom, because it brings the molecule closer to or farther away from the viewer. Translation commands are expressed in percentage. Thus, to double the magnification (zoom), a numerical value of 200 is used.

Rotation, translation, and zoom commands to effect a desired view can be incorporated in the initial loading of a pdb.

There are other, smoother ways to move, rotate, and zoom molecules that will be discussed later, in the Animation section.

Sample Loading and Positioning Commands

Buttons/Effects
code for buttons =
<script language="JavaScript" type="text/javascript">
jmolRadio('!quit; zap;Jmol scripts here', "", false );
</script>

relevant Jmol scripts in buttons (the scripts below are often supplemented by commands that orient molecules and change default displays - see NB, above)

Place between ' ' in button code

  load a new molecule (.pdb file) load 'path to the pdb file', e.g.
load ../pdbs/a-helix.pdb

  rotate 90° on X axis

rotate x 90;
  rotate 180° on Y axis rotate y 180;
  rotate 90° on Z axis rotate z 90;
  translate 10% to right on X axis translate x 10;
  translate 10% to left on X axis translate x -10;
  translate 10% up on Y axis translate y -10;
  translate 10% down on Y axis translate y 10;
  translate 50% on z axis (zoom in) zoom 150;
  translate -50% on z axis (zoom out) zoom 50;

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



IV. Selecting and Labeling

For the display commands already discussed, and for coloring and bond options to be addressed later, it is often desirable to limit rendering changes to particular atoms or sets of atoms. The select command is used to specify what atoms of a molecular file will be affected by subsequent rendering commands (e.g spacefill, cartoons, etc.).

There are a number of predefined sets of atoms such as "all", "backbone", "protein", "ligand", "hetero", "helix", "sheet", "sidechain", etc..

"Select all" selects all atoms.

"Select protein" or "select amino" both select all of the amino acids.

"Select nucleic" selects all nucleic acid atoms, but "select dna" or "select rna" works on specified nucleic acid residues (DNA=a,t,g,c; RNA=a,u,g,c).

"Select hetero" will select all heterogeneous atoms, including water, ions, and ligands.

"Select water" or "select hoh" will select only the water molecules (usually only oxygen atoms of water are present in a pdb file), and "select ligand" will select only a ligand.

"Select helix" and "select sheet" are used to select alpha helices and beta sheets, respectively.

"Select backbone" and "select sidechain" are used to select backbone or sidechain atoms, respectively.

The select command can also be used to select a specific chain in a molecular file, a single amino acid, or even a single atom (useful!). In selecting atoms or residues, it is possible to discriminate between chains in a file that contains multiple molecules. For example, let's say that you wish to select a single residue (#10) on one chain of a pdb file with a dimeric protein bound to DNA (four chains). Each chain will likely have a residue # 10. If the command "select 10" were used, four residues would be selected, one on each of the protein chains and one on each strand of DNA. Instead, if the desired residue (#10) is on chain A, then the script "select :a and 10" or "select 10:a" would select only residue #10 on chain A, ignoring the residue #10s on other chains.

Define is a command that is very useful when dealing with a group of atoms that do not belong to a predefined set, such as a phosphate on a ligand or the tail of an ATP molecule. The atoms of interest can be associated under one atom expression that can then be selected with ease. The format of the script for defining a group of atoms is "define 'name of group' 'atoms to be grouped' ".

Another type of selection is the restrict command. "Restrict" limits the display to those atoms specified in the restrict script.

Selected atoms can be labeled using the label command. Labels can be colored, and the fontsize height set (in pixels) using appropriate commands. The default label color is the selected atom's color and the default fontsize is 8 pixels. The position of the label can be altered by setting the label offset.

Sample Selecting and Labeling Commands

Buttons/Effects
code for buttons =
<script language="JavaScript" type="text/javascript">
jmolRadio('!quit; zap;Jmol scripts here', "", false );
</script>

relevant Jmol scripts in buttons (the scripts below are often supplemented by commands that orient molecules and change default displays - see NB, above)

Place between ' ' in button code

  display all atoms in spacefill select all; spacefill; select nucleic; color red; select protein; color magenta;
  display protein in spacefill, display RNA in wireframe select protein, nucleic; wireframe; select amino; spacefill; or select all; wireframe; select protein; spacefill;
  display RNA in spacefill, display protein in wireframe select rna, protein; wireframe; select nucleic; spacefill;
  display hetero atoms in spacefill, other molecules in wireframe select all; wireframe; select hetero; spacefill;
  display water atoms in spacefill, other molecules (including other hetero atoms) in wireframe select all; wireframe; select hoh; spacefill;
  display ligand atoms in default spacefill, water in small spacefill, other molecules in wireframe

select all; wireframe; select hoh; spacefill 200; select ligand; spacefill;

  display alpha helices in cartoons, remainder of protein in trace, all other atoms and molecules off select all; wireframe off; select protein; trace 40; select protein and helix; trace off; cartoons;
  display beta sheets in cartoons, remainder of protein in trace, all other atoms and molecules off select all; wireframe off; select protein; trace 40; select protein and sheet; trace off; cartoons;
  display chain B in spacefill, chain Q in wireframe 80, all other atoms off select all; wireframe off; select :b, :q; wireframe 80; select :b; spacefill;
  display chain Q in cartoons, all other atoms off restrict :q; cartoons;
  display lysine residues and adenine residues in spacefill, water off, other atoms in wireframe select all; wireframe; select lys, a; spacefill;
  display residue 13 in both chains in spacefill, other atoms in these chains in wireframe, all other atoms off select all; wireframe; select hetero; wireframe off; select 13; spacefill; select hoh; spacefill off;
  display residue 13 in chain B in spacefill, other atoms in chains in wireframe, all other atoms off select all; wireframe; select hetero; wireframe off; select 13:b; spacefill;

  display atom #2318 in spacefill, water atoms off, all other atoms in wireframe

select all; wireframe; select atomno=2318; spacefill;
  display atoms 2301-2320 (residue 13 of chain Q) in spacefill, waters off, all others atoms in wireframe select all; wireframe; select atomno>2300 and atomno<2321; spacefill;
  define residues 10-12 on RNA as "contact," display as cartoons, other parts of molecules in trace select protein, nucleic; trace 40; define contact 10:q, 11:q, 12:q; select contact; cartoons;
  display ligand atoms in spacefill, all others in wireframe, label atom number 3923 "glycerol" select all; wireframe; select ligand; spacefill; select atomno=3923; label glycerol; color label black;
  display ligand atoms in spacefill, all others in wireframe, label atom number 3923 "glycerol," offset label [x, 20; y, 0] select all; wireframe; select ligand; spacefill; select atomno=3923; label glycerol; color label black; set labeloffset 20 0;
  display ligand atoms in spacefill, all others in wireframe, label atom number 3923"glycerol," offset label [x, 20; y, 0], set fontsize of label to 20, set color lof label to red select all; wireframe; select ligand; spacefill; select atomno=3923; label glycerol; color label black; set labeloffset 20 0; set fontsize 20; color label red;
  turn labels off select all; label off;

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



V. Coloring and Coloring Schemes

Coloring atoms, sets of atoms, or other selections is quite useful in crafting quality molecular exhibits. Explanatory text can be co-colored with specified structural features. Jmol is quite versatile in recognizing the names of prespecified colors, HTML binhex color codes, and RGB triplet codes.

Jmol recognizes the RasMol defined color set and an extensive list of Javascript colors. Recognized colors include: blue, deepskyblue, cornflowerblue, cadetblue, turquoise, cyan, yellow, gold, green, greenblue, chartreuse, mediumspringgreen, aquamarine, deeppink, magenta, purple, darkmagenta, blueviolet, violet, orange, red, redorange, indianred, lightsalmon, tan, burlywood, sienna, gray, white, and black.

HTML binhex and RGB triplet codes are similar in that the colors are made up of alphanumerical values for red green and blue. For binhex, the highest value is FF and the lowest is 00 (zeros, not O's). For RGB, the highest value is 255 and the lowest is 0. The format for binhex in Jmol is [x(Red)(Green)(Blue)], e.g. "color [xFF0088]". The format for RGB triplet codes in Jmol is [(Red),(Green),(Blue)], e.g. "color [255,0,255]".

Default coloration is CPK (Corey, Pauling, Kultun), based on atom identity. Carbon is colored light gray, oxygen red, hydrogen white, nitrogen light blue, sulfur yellow, phosphorous orange, chlorine green, zinc brown, sodium blue, iron purple, calcium or metals dark gray, and unknown deep pink. In addition to CPK, Jmol has access to some additional predefined color schemes (not all schemes are discussed here):

"Amino" is a scheme that assigns colors to amino acids based on their chemical properties, e.g. acidic, basic, hydrophobic, or polar. The colors are ASP, GLU, CYS, MET, LYS, ARG, SER, THR, PHE, TYR, ASN, GLN, GLY, LEU, VAL, ILE, ALA, TRP, HIS and PRO. Nucleic acids are colored tan in the "amino" scheme.

"Chain" is a scheme that colors each different chain in a multiple molecule pdb file a different color.

"Group" is a scheme that colors protein chains differentially in the amino-carboxy direction.

"Group" colors nucleic acid chains differentially in the 5'>3' direction.

"Temperature" is a scheme that colors atoms according to their anisotropic temperatures, as stored as a beta value in a pdb file. Anisotropic temperature is indicative of of an atom's mobility or uncertainty of position. The more mobile, "warmer" segments are colored red, progressing to more immobile blue fragments.

"Structure" is a very useful color scheme in that it differentially colors a protein's secondary structure (a-helices and b-sheets). It is best to use a display command that illustrates secondary structure when using the structure color scheme (e.g. ribbons, cartoon, backbone, trace, or strands - see Display section).

It is quite effective to use consistent color schemes to show some molecular features. DRuMS is a set of seven color schemes that provides a uniform standard for coloration in molecular exhibits. The colors used in the basic DRuMS scheme are: protein, DNA, RNA, a-helix and b-sheet. For amino acids the DRuMS colors are: hydrophobic amino acids, polar acidic amino acids, polar basic amino acids, and polar uncharged amino acids. See the DRuMS website for further information:

It is sometimes necessary to go beyond the DRuMS schemes to illustrate important structural features. For example, it may be useful to distinguish between several pairs of chemically similar amino acids engaged in ionic bonding. In this case, custom colors must be used to indicate molecular identity. Fortunately, it is easy to instruct Jmol to read any user-specified color code.

More information on color options is available on the Jmol colors page.

Sample Coloring Commands

Buttons/Effects
code for buttons =
<script language="JavaScript" type="text/javascript">
jmolRadio('!quit; zap;Jmol scripts here', "", false );
</script>

relevant Jmol scripts in buttons (the scripts below are often supplemented by commands that orient molecules and change default displays - see NB, above)

Place between ' ' in button code

  display protein in deepskyblue cartoons, nucleic acid in CPK default coloration and spacefill select protein; cartoons; color deepskyblue; select nucleic; spacefill; color cpk;
  display protein in magenta cartoons, nucleic acid in yellow spacefill using HTML binhex select protein; cartoons; color [xFF00FF]; select nucleic; spacefill; color [xFFFF00];
  display protein in blue cartoons, nucleic acid in yellow spacefill using RGB select protein; cartoons; color [0,0,255]; select nucleic; spacefill; color [255,255,0];
  display DNA and protein in "amino" scheme select all; color amino;
  display protein in cartoons, DNA in spacefill, color chains differentially select protein; cartoons; select nucleic; spacefill; select all; color chain;
  display one protein chain in trace, color in "group" scheme restrict :a; trace 100; select all; color group;
  display one protein chain in spacefill, color in "temperature" scheme restrict :a; spacefill; color temperature
  display protein in cartoons, color in "structure" scheme restrict protein; cartoons; color structure;

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



VI. Illustrating Bonds and Drawing Arrows

Jmol recognizes by default the standard covalent bonds linking atoms in a molecule. Disulfide (S-S) bonds can also be displayed in Jmol by the use of the "ssbonds" command. The color of the bond is that of the two linked atoms, but it can be changed with the "color ssbonds" command. Similarly, "hbonds" and "color hbonds" tells Chime to show and color hydrogen bonds that are identified by Jmol.

You may wish to illustrate a connection or bond that is not specified in a pdb file or read by Jmol. This can be accomplished in several ways, depending on your preferences. Two of these are MEASURE and CONNECT.

> The MEASURE command allows you to connect two atoms of choice with the distance between them displayed by default. You can specify the distance units as Angstroms if you wish, instead of the default nm (see below). To turn off the distance label, use the SET MEASUREMENT OFF command. MEASURE OFF and MEASURE ON can be used to toggle the measurment line off and on.

> The CONNECT command also allows you to connect two atoms of choice via bond creation and permits a wide choice of display options for the new bond. See below for CONNECT techniques.

To build an arrow in your molecular display, you can use the DRAW command. To start, use the Jmol.jar application and pick an imaginary line between two atoms such that the line lies mostly outside the molecule. Use the following script to construct an arrow:

$ "draw arrow arrow scale .5 width .5 (atomno=#ofatom1) (atomno=#ofatom2); color draw limegreen"

Naturally you use any color you wish and can scale the arrow and change its width as you see fit. Then, after using the $ "set picking draw" command, you can use the "SHIFT" key and mouse to drag the arrow to any position in your display. Use the "ALT" key ("OPTION" in Macs) and mouse to change the vertices of the arrow to position it as you see fit. When you have finished, be sure to reset the picking status by using $ "set picking on." Then use the $ "show draw" command to obtain a complete set of commands that you can use in your webpage button to draw the arrow in the position you want.

Sample Bond / Arrow Commands

Buttons/Effects
code for buttons =
<script language="JavaScript" type="text/javascript">
jmolRadio('!quit; zap;Jmol scripts here', "", false );;
</script>

relevant Jmol scripts in buttons (the scripts below are often supplemented by commands that orient molecules and change default displays - see NB, above)

Place between ' ' in button code

  display protein backbone in trace, cys residues in wireframe select protein; trace 40; select cys; wireframe 80;
  display protein backbone in trace, cys residues in wireframe, show S-S bonds select protein; trace 40; select cys; wireframe 80; ssbonds 40;
  display protein backbone in trace, cys residues in wireframe, color S-S bonds purple, thicken S-S bonds select protein; trace 40; select cys; wireframe 80; ssbonds 80; color ssbonds purple;

  remove S-S bonds

select protein; trace 40; select cys; wireframe 80; ssbonds 1; ssbonds off;
  make an arbitrary bond between two atoms of choice (#500 and #199), showing distance between them, using the MEASURE option measure 500 199;
  set distance measurement in Angstroms instead of nm measure 500 19 "//A"; measure 500 19 "//A";
  remove distance label of arbitrary measurement "bond" measure 500 199; delay 2; set measurement off;
  toggle measurment "bond" on and off measure 500 199; set measurement off; delay 1; measure off; delay 1; measure on; delay 1; measure off; delay 1; measure on;
  delete arbitrary measurement "bond" measure 500 199; set measurement off; delay 2; measure delete;

  make an arbitrary bond between two atoms of choice (#500 and #199), using connect option.

NOTE: observe the types of manipulations possible with delays in between the examples:

  • the bond starts out with the color of the atoms involved
  • the bond is set to be colored deepskyblue
  • the bond diameter is increased to wireframe 100
  • the bond is colored limegreen and diameter is increased to wireframe 200
  • the bond is colored salmon and diameter is decreased to wireframe 30
  • the bond is deleted

connect (atomno=500) (atomno=199); select atomno=500, atomno=199; delay 3; color bonds deepskyblue; delay 3; set bondMode AND; wireframe 100; delay 3; color bonds limegreen; set bondMode AND; wireframe 200; delay 3; color bonds salmon; set bondMode AND; wireframe 30; delay 3; connect delete;

  display B-DNA, show hydrogen bonds between base pairs load bdna2.pdb; hbonds;
  color hydrogen bonds magenta, thicken hbonds hbonds 50; color hbonds magenta;
  remove hydrogen bonds hbonds off;
  draw an arrow

draw ID "draw1" diameter 0.5 ARROW {9.225235 9.573756 6.8634644} {10.837601 14.456245 5.3951683}; draw ID "draw1" fill noMesh noDots notFrontOnly fullylit;
color draw opaque [x32cd32];

note: the above set of commands was obtained in the Jmol application using the procedure outlined above

select atomno=164; spacefill 200; color magenta

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



VII. Animation

Animations are sometimes superior to the rotations and translations discussed previously because animations can cause the molecule at hand to move or change position in a smooth fashion. Coupled with creative displays and coloration, animation commands can be employed to great effect in illustrating key points of molecular structure.

One of the most useful animation commands is "move." "Move" is followed by a set of numbers that quantify a set of animation parameters. Here we describe the use of the first nine such parameters, i.e.: "move _ _ _ _ _ _ _ _ _ ", where each of the nine spaces contains a number that specifies the degree of an animation parameter. The parameters for each space following a "move" command (in order) are:

1 2 3 4 5 6 7 8 9
Xrot YRot ZRot Zoom XTrans YTrans ZTrans Slab TotalTime

The first three parameters are rotations around the X, Y and Z axes. Fourth is the zoom modifier, expressed in positive (zoom in) or negative (zoom out) numbers. Note that in a "move" command, zoom values are not expressed in percentages of the original, unlike the use of "zoom" as a stand alone script command. The next three parameters (5,6 and 7) deal with translation along the three axes (7, Z translation, is not functional - always use zero in that slot). Note: contrary to intuition, positive numbers for Y translation move molecules down and negative numbers move molecules up. 8th is the slab parameter. Slab "slices" the molecule, i.e. removes atoms down to a specified depth so that interior features may be easily observed. Parameter 9 is the amount of time (in seconds) to take in performing the previous move commands. It is important to allow sufficient time for the animation so as not to disorient the viewer. Contrariwise, too long an animation can prove tedious. There are two other move parameters, Frames/Second and MaximumAcceleration that can be specified in the 10th and 11th positions (not considered here).

So, "move 0 360 0 200 0 15 0 0 6" would, in 6 seconds, rotate a molecule 360 degrees around the Y axis, while simultaneously zooming (200) and moving the molecule down (Y axis translation: +15). "Move" is used in some of Jmol's most impressive animations and provides great versatility, especially when coupled with "delay."

"Delay" pauses the Jmol script for a specified amount of time before the next command is executed. "Delay" is specified in seconds, e.g. "delay 5" causes a pause of five seconds. In addition to use in animations, "delay" can be an effective tool in a variety of display and coloration contexts.

Perhaps the most essential animation command is "moveto". The "moveto" command can be used to rotate a molecule around each axis and to zoom. This command is useful when using the Jmol application to determine the best viewing orientation of a molecule. After adjusting the orientation of a molecule, Use the "show orientation" command in the apllication scripting (console) window to display the appropriate "moveto" command to elicit a particular orientation of choice. Then use this "moveto" command in your button scripts as needed. In the following example, a molecule has been positioned in the Jmol application, and the show orientation command has been used to generate "moveto" parameters. You can copy and paste the resulting moveto command (e.g. moveto /* time, axisAngle */ 1.0 { -26 -999 33 86.98} /* zoom, translation */ 100.0 0.0 0.0 /* center, rotationRadius */ {79.3055 -9.8464985 100.432} 84.115654 /* navigation center, translation, depth */ {0 0 0} 0 0 0 /* cameraDepth, cameraX, cameraY */ 3.0 0.0 0.0;) into a button script to orient the molecule to your moveto specifications. Note: the first number is the time, in seconds, to execute the move, so if you are using a moveto to orient a molecule to a correct position prior to displaying it in a webpage/button, you can change the "1.0" to, say, "0.2". If your moveto is being used to take the reader from one orientation to another in order to illustrate a structural feature, you will probably change the time to >4 seconds.

For more information on "moveto", see the Jmol Interactive Scripting documentation.

To create a new *.pdb file that contains two molecules superimposed in order to easily illustrate relevant conformational changes, use the SUPERPOSE program, kindly provided at: http://wishart.biology.ualberta.ca/SuperPose/. By uploading two molecules that differ slightly in conformation, SUPERPOSE will generate a "result".pdb containing two models that you can manipulate to illustrate conformational shifts (see example below).

Changes in display (e.g. wireframe thickness, spacefill radii), separated by brief delays, can be used to "build up" or "dissolve" molecules to provide smooth transitions in rendering.

Blinking can be used to draw attention to particular molecular features (e.g. bonding partners). Blinking is achieved by causing the feature to flash on and off or to expand and contract a few times, using appropriate display commands separated by delays.

The "loop" command can be used to repeat a particular animation script (or any other script) until another command is invoked. "loop 3" indicates the previous script commands will be repeated after a 3 second delay.

Sample Animation Commands

Buttons/Effects
code for buttons =
<script language="JavaScript" type="text/javascript">
jmolRadio('!quit; zap;Jmol scripts here', "", false );
</script>

relevant Jmol scripts in buttons (the scripts below are often supplemented by commands that orient molecules and change default displays - see NB, above)

Place between ' ' in button code

  display molecule in tuquoise cartoons, rotate 90º around X axis in 3 seconds, pause for 1 second, rotate back in 3 seconds select all; color turquoise; cartoons; move 90 0 0 0 0 0 0 0 3; delay 1; move -90 0 0 0 0 0 0 0 3;

  display molecule in tuquoise cartoons, rotate 90º around Y axis in 3 seconds, pause for 1 second, rotate back in 3 seconds

select all; color turquoise; cartoons; move 0 90 0 0 0 0 0 0 3; delay 1; move 0 -90 0 0 0 0 0 0 3;
  display molecule in tuquoise cartoons, rotate 90º around Z axis in 3 seconds, pause for 1 second, rotate back in 3 seconds select all; color turquoise; cartoons; move 0 0 90 0 0 0 0 0 3; delay 1; move 0 0 -90 0 0 0 0 0 3;
  display molecule in CPK wireframe, zoom in (100) in 3 seconds, pause for 1 second, zoom out in 3 seconds select all; color cpk; wireframe 80; move 0 0 0 100 0 0 0 0 5; delay 2; move 0 0 0 -100 0 0 0 0 5;
  display molecule in CPK wireframe, translate X (25), pause for a second, translate back select all; color cpk; wireframe 80; move 0 0 0 0 25 0 0 0 5; delay 1; move 0 0 0 0 -25 0 0 0 5;
  display molecule in CPK wireframe, translate Y (25), pause for a second, translate back move 0 0 0 0 0 25 0 0 5; delay 1; move 0 0 0 0 0 -25 0 0 5;
  display protein in indianred cartoons, chromophore in mediumspringgreen spacefill, cut away 40% of molecule to show chromophore, rotate 90º on X axis in 4 seconds, restore all atoms select all; color indianred; cartoons; select cro; color mediumspringgreen; spacefill; delay 2; slab on; slab 60; delay 1; move 90 0 0 0 0 0 0 0 4; delay 1; slab off;
  display protein in indianred cartoons, chromophore in mediumspringgreen spacefill, cut away 40% of molecule to show the chromophore in the interior, spin molecule on y axis (20º/second)

select all; color indianred; cartoons; select cro; color mediumspringgreen; spacefill; delay 2; slab on; slab 60; delay 1; set spin y 20; spin

  "build up" a molecule: wireframe to spacefill select all; wireframe; delay .1; wireframe 30; spacefill 30; delay .1; spacefill 50; delay .1; spacefill 75; delay .1; spacefill 100; delay .1; spacefill 125; delay .1; spacefill 150; delay .1; spacefill 175; delay .1; spacefill 200; delay .1; spacefill 225; delay .1; spacefill 250; delay .1; spacefill 275; delay .1; spacefill 300; delay .1; spacefill 325; delay .1; spacefill 350; delay .1; spacefill 375; delay .1; spacefill 400; delay .1; spacefill
  "dissolve" a molecule: spacefill to wireframe select all; spacefill; wireframe 30; delay .1; spacefill 400; delay .1; spacefill 375; delay .1; spacefill 350; delay .1; spacefill 325; delay .1; spacefill 300; delay .1; spacefill 275; delay .1; spacefill 250; delay .1; spacefill 200; delay .1; spacefill 175; delay .1; spacefill 150; delay .1; spacefill 125; delay .1; spacefill 100; delay .1; spacefill 75; delay .1; spacefill 50; delay .1; spacefill 30; wireframe 30; delay .1; spacefill off; wireframe;
  dissolving to show or emphasize a moiety

select all; color cpk; spacefill; select hetero; spacefill off; select cro; color mediumspringgreen; spacefill; delay 2; move 90 0 0 0 0 0 0 0 4; delay 1; select protein; spacefill; wireframe 30; delay .1; spacefill 400; delay .1; spacefill 375; delay .1; spacefill 350; delay .1; spacefill 325; delay .1; spacefill 300; delay .1; spacefill 275; delay .1; spacefill 250; delay .1; spacefill 200; delay .1; spacefill 175; delay .1; spacefill 150; delay .1; spacefill 125; delay .1; spacefill 100; delay .1; spacefill 75; delay .1; spacefill 50; delay .1; spacefill 30; wireframe 30; delay .1; spacefill off; wireframe; delay 1; move -90 0 0 0 0 0 0 0 4; delay 1; set spin y 20; spin

  use of dissolving and blinking to emphasize a moiety

select cro; spacefill off; delay .5; spacefill; delay .5; spacefill off; delay .5; spacefill; delay .5; spacefill off; delay .5; spacefill; delay .5; spacefill off; delay .5; spacefill; delay .5;
a long script that uses "BOILERPLATE" settings to acheive a blank slate with appropriate settings to begin visualization of a molecule, and a pdb created with the SUPERPOSE program in order to illustrate conformational changes. Note the switching between models that were generated in the SUPERPOSE output. load 2dn2_2dn1.pdb; model all; ##### BOILERPLATE start #####; select all; wireframe off; spacefill off; ribbons off; strands off; cartoons off; spin off; trace off; dots off; draw off; set frank off; set echo bottom center; echo PDB ID: 2DN2 (deoxy) >> 2DN1 (oxy); color echo black; set ambient 40; set specpower 40; slab off; label off; monitor off; measurements off; set measurementunits angstroms; set defaultdistancelabel "%0.1VALUE \u00c5"; set labelfront on; set ribbonborder on; set antialiasdisplay on; isosurface delete; ##### BOILERPLATE end #####; moveto /* time, axisAngle */ 0.1 { -777 593 212 125.95} /* zoom, translation */ 265.98 -20.49 17.02 /* center, rotationRadius */ {28.1835 28.1835 0.0} 36.82993 /* navigation center, translation, depth */ {0.0 0.0 0.0} 61.55707 -97.41382 0.0; ##### DEFINITIONS START#####; define ~alpha :a; define ~beta :b; ##### DEFINITIONS END#####; delay 2; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; font echo 50;color echo blue; select his87; color amino; select his87 and model=1; wireframe 100; select atomno=648 and model=1; label his87; color label black; delay 2; select atomno=648 and model=1; label his87; color label black; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; color amino; select oxy; spacefill 175; color red; delay 2; select model=1.2; trace off; spacefill off; wireframe off; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; font echo 50;color echo blue; select his87; color amino; select his87 and model=1; wireframe 100; select atomno=648 and model=1; label his87; color label black; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; select oxy; spacefill 175; color red; delay 2; select model=1.2; trace off; spacefill off; wireframe off; select oxy; spacefill off; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; color echo blue; select his87 and model=1; wireframe 100; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; select oxy; spacefill 175; color red; delay 2; select model=1.2; trace off; spacefill off; wireframe off; select oxy; spacefill off; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; color echo blue; select his87 and model=1; wireframe 100; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; select oxy; spacefill 175; color red; delay 2; select model=1.2; trace off; spacefill off; wireframe off; select oxy; spacefill off; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; color echo blue; select his87 and model=1; wireframe 100; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; select oxy; spacefill 175; color red; delay 2; select model=1.2; trace off; spacefill off; wireframe off; select oxy; spacefill off; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; color echo blue; select his87 and model=1; wireframe 100; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; select oxy; spacefill 175; color red; delay 2; select model=1.2; trace off; spacefill off; wireframe off; select oxy; spacefill off; select model=1 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1; color cpk; wireframe 75; spacefill 150; select iron and model=1; spacefill 250; set echo bottom center; echo DEOXY; font echo 50; color echo blue; select his87 and model=1; wireframe 100; delay 2; select model=1; trace off; spacefill off; wireframe off; select model=1.2 and protein; trace 10; color turquoise; select his87; color amino; select hem and model=1.2; color cpk; wireframe 75; spacefill 150; select iron and model=1.2; spacefill 250; set echo bottom center; echo OXY; font echo 50; color echo red; select his87 and model=1.2; wireframe 100; select oxy; spacefill 175; color red;
a display using selection, define, several types of animation, dissolving and building, culminating in blinking hydrogen bonds between a base pair in double helical DNA - any part of the script to the right is easily copied and pasted into a custom script of the user's choice load bdna2.pdb; set frank off; select all; hbonds off;select all; spin off; wireframe off; spacefill off; trace off; set ambient 40; set specpower 40; slab off; ribbons off; cartoons off; label off; monitor off; moveto /* time, axisAngle */ 3.0 { -580 593 558 99.96} /* zoom, translation */ 100.0 0.0 0.0 /* center, rotationRadius */ {15.559 19.973 9.841499} 27.31514 /* navigation center, translation, depth */ {0 0 0} 0 0 0 /* cameraDepth, cameraX, cameraY */ 3.0 0.0 0.0; select all; color cpk; spacefill; select hoh; wireframe off; spacefill off; delay 1; select dna; spacefill; wireframe 30; delay .1; spacefill 400; delay .1; spacefill 375; delay .1; spacefill 350; delay .1; spacefill 325; delay .1; spacefill 300; delay .1; spacefill 275; delay .1; spacefill 250; delay .1; spacefill 200; delay .1; spacefill 175; delay .1; spacefill 150; delay .1; spacefill 125; delay .1; spacefill 100; delay .1; spacefill 75; delay .1; spacefill 50; delay .1; spacefill 30; wireframe 30; delay .1; spacefill off; wireframe; delay 1; moveto /* time, axisAngle */ 4.0 { 181 -10 983 80.79} /* zoom, translation */ 100.0 0.0 0.0 /* center, rotationRadius */ {15.559 19.973 9.841499} 27.31514 /* navigation center, translation, depth */ {0 0 0} 0 0 0 /* cameraDepth, cameraX, cameraY */ 3.0 0.0 0.0; define bp 1:a,12:b; select bp; wireframe; delay .1; wireframe 10; delay .1; wireframe 20; delay .1; wireframe 30; delay .1; wireframe 40; delay .1; wireframe 50; spacefill 50; delay .1; spacefill 60; delay .1; spacefill 70; delay .1; spacefill 80; delay .1; spacefill 90; delay .1; spacefill 100; delay 1; select dna and not bp; wireframe off; select bp; hbonds 30; select hoh; color white; select bp; delay 1; hbonds off; delay 1; hbonds 30; delay 1; hbonds off; delay 1; hbonds 30; delay 1; hbonds off; delay 1; hbonds 30; delay 1; hbonds off; delay 1; hbonds 30; delay 1; hbonds off; delay 1; hbonds 30;

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]



VIII. Constructing Composite PDB files

It is sometimes useful to model molecular interactions by combining molecules from two or more separate pdb files. For example, perhaps you wish to visualize an interaction between a DNA binding protein and DNA, but the pdb file you have to work with only contains the protein. You therefore wish to add DNA to your PDB and model the protein-DNA interaction. Important(!): if you create a new pdb file by incorporating atoms from two separarate pdbs, you must state this clearly when you present your new pdb. It is essential that your reader know that you have MODELED an interaction and that your composite pdb file does not actually represent a structural determination of interacting molecules! To create a composite pdb file, you first determine which elements of existing pdbs you wish to extract and combine. This section is under construction.

return to beginning of exhibit

[Introduction] [II. Display] [III. Loading and Positioning] [IV. Selecting and Labeling]
[V. Coloring and Schemes]
[VI. Illustrating Bonds] [VII. Animation]


 



Back to OMM Exhibits


Note: if this tutorial is helpful in the creation of your own webpages, please explicitly acknowledge your use of this page (URL, Author, and a link to this page) in your webpage/s. And please drop an email to marcey@callutheran.edu.edu with a link to your page/s. This helps with funding opportunities for the OMM and helps ensure continued development of this resource. Thanks!