Summary of JSmol Script Command Expressions
and Image Manipulation Operations

Duane W. Sears, University of California Santa Barbara
See - https://chemapps.stolaf.edu/jmol/jsmol/jsmol.htm
https://chemapps.stolaf.edu/jmol/docs/index.htm?ver=14.3.13_2015.05.12
http://www.jmol.org/

Index of JSmol (RasMol) Script Commands, Expressions, & Operations
Image Movement
w/Mouse  or  w/Commands
Command
Examples
Global
Commands
Set Picking
Commands
Atom
Expressions
Predefined
Sets
Wild Cards Colors
Commands / Schemes / Amino Acids
Image Screen Capture
   (Copy/Paste Image)
Boolean (Logic)
Operators
H-Bonds / Disulfide Bonds
Within / Define / IsoSurface Move Commands
Within Expression Define Command Surface & List Commands PDB Name Conventions

Image Movement with Mouse Buttons & Keys [return to Index]
To move a structural image, hold the Mouse Button and Key down while sliding the mouse pointer over the screen image.
Screen Action Windows
Mouse Button (left/right)
+ Key
Macintosh
Mouse Button
(only one)
+ Key
popup menu right btn, pointer stationary btn down, pointer stationary
X-rotation left btn, drag pointer btn down, drag pointer
Y-rotation left btn, drag pointer btn down, drag pointer
Z-rotation right btn +Shift, drag pointer   (none)
X-translation right btn, +Ctrl, drag pointer btn down, +Option, drag pointer
Y-translation right btn +Ctrl, drag pointer   btn down +Option, drag pointer
zoom in left btn +Shift, drag  pointer btn down +Shift, drag pointer
shrink left btn +Shift, drag pointer btn down +Shift, drag pointer

Image Movement Commands [return to Index]
Screen Action Command Argument {optional}
rotate <axis> {+/-} <value>: Rotates a molecule about the "x," "y," or "z" <axis> by a specified {+/-} <value> angle in degrees. rotate <axis> {+/-} <value>
translate  <axis> {+/-} <value>: Translates a molecule along the "x," "y," or "z" <axis> by a {+/-} <value> arbitrary distance. translate <axis> {+/-} <value>
zoom {+/-} <value>: Zooms in or out {+/-} <value> along the "z" axis creating an arbitrary magnification or demagnification of the structure. zoom {+/-} <value>
center the pivot point of rotation to the weighted average position calculated from the relative positions of all atoms defined in an <expression> center <expression>
reset orientation and center point to default settings reset (none)

Command Examples [return to Index]
Screen Action Command(s) Argument {optional}
select all atoms in the displayed image (pdb) file select all or *
select :a, or select *a, to include all atoms of chain :a (or *a) as in the displayed image (pdb) file select :a or *a
label{s} %m produces one-letter amino acid labels for all atoms currently selected label{s} %m
label{s} %n produces three-letter amino acid labels for all atoms currently selected %n
label{s} %r produces amino acid residue number labels for all atoms currently selected %r
color {<object>} <color>  (or cpk) will color the currently selected atoms {of the specified <object>} with the <color> specified (or with default "CPK" colors) color {<object>} <color>
h-bond{s} {<value>} {on/off} will toggle H-bonds on or off as dotted lines of arbitrary width {<value>}; default color green hbond{s} {<value>} {on/off}
ssbond{s} {<value>} {on/off} will toggle disulfide bonds on or off as dotted lines of arbitrary width {<value>}; default color gold ssbond{s} {<value>}
{on/off
}

Global Image Modification Commands [return to Index]
Screen Action Command Argument {optional}
wireframe {<value>} {on/off}: Creates wireframe image of arbitrary thickness <value>. wireframe {<value>}
{on/off}
trace {<value>} {on/off}: Creates trace through the polypeptide backbone alpha carbons (or the phosphate atoms of a DNA or RNA) of arbitrary thickness <value>; default color = Ca atom color (or = phosphate atom color). trace {<value>}
{on/off}
cartoon{s} {<value>} {on/off}: Creates a ribbon through the peptide backbone (or the phosphodiester bonds atoms of a DNA or RNA) of arbitrary thickness <value> with arrowheads pointing in the N-to-C direction for beta sheet strands; default color  atom color of the Ca carbons or the phosphate atom color. cartoon{s} {<value>}
{on/off}
ribbon{s} {<value>} {on/off}: Creates a ribbon through the peptide backbone (or the phosphodiester bonds atoms of a DNA or RNA) of arbitrary thickness <value>; default color = Ca atom color (or = phosphate atom color). ribbon{s} {<value>}
{on/off}
color <object> <color>: Changes <object> to specified <color>. color <object> <color>
spacefill {on/off}: Creates hard spheres of van der Waals radii. spacefill (none)
on/off
spacefill {<value>}: Creates hard spheres of Angstroms radii (if <value> has a decimal point) or of arbitrary radii (if <value> = 0-700) spacefill <value>
restrict <expression>:  Restricts display to only those atoms defined by the <expression>. restrict <expression>
slab {<value>} {on/off}: Creates a slab view where the molecule is sliced in the xy plane at the <value> point on the "z" axis leaving in view only the portion of the molecule behind this  "clipping plane." slab {+/-} {<value>} on/off
set ambient {<value>}: Changes the depth-cueing/lighting effects on the displayed image with <value> ranging between 0 (dark) to 100 (light). set ambient {<value>}
set shadow{s}{on/off}: Toggles atom shadowing on/off set shadow{s} on/off
set specpower {<value>}:  Changes the shininess of spacefilled atoms of the <value> ranging between 0 (flat) to 100 (very shiny). set specpower {<value>}
set specular {on/off}:  Toggles atom lighting effect on/off. set specular on/off
connect {on/off}: Connects all bonds with abnormal bond lengths.
  • The default setting is off when a pdb file is loaded into the Chime window.
  • In order to connect abnormal bonds, the "connect on" or "connect true" command must be in the embedded script commands that run as a structure is initially loaded into the plug-in embedded on a web page. 
  • If the "connect on" is issued after the structure is loaded (and visible), abnormal bonds will not be connected.
  • Example:  See Rnase A/ UVC inhibitor complex (6rsa.pdb) @ http://mcdb-webarchive.mcdb.ucsb.edu/sears/biochemistry/tw-enz/rnasea/rnasea-inhibitorf.htm.  A connect command is needed to complete the 5 covalent bonds of the pentacovalent vanadate ion.
connect on/off {default}

Set Picking Commands [return to Index]
"Set Picking" commands activate the mouse pointer and button for retrieving information from the image or displaying this information on the image.
Note: After issuing the "set picking <value>" command, move the mouse pointer over one atom in the image and click the mouse button (while holding down the Control, Option, or Command key if using a Macintosh).
set picking none: Inactivates the mouse pointer and button and turns picking "off." set picking none
set picking identify: Returns the label for an atom selected by the mouse to the browser status bar and RasMol/Chime message box (when displayed). set picking identify
set picking label: Displays the identifier label on the image for an atom selected by the mouse. set picking label
set picking distance: Returns the distance between 2 atoms sequentially selected by the mouse to the browser status bar and RasMol/Chime message box (when displayed). set picking distance
set picking center: Changes the pivot point of image rotation to the position of the atom selected by the mouse. set picking center
set picking monitor: Displays the distance in Angstroms between 2 atoms sequentially selected by the mouse and connects them with a dashed line and on the image. set picking monitor(s)
monitors off: Removes all distances and connecting lines currently displayed on the image, but does not turn off the distance monitor function; to turn the monitor function off use set picking none. monitor(s) off
set picking angle: Returns the angle defined by 3 atoms sequentially selected with the mouse to the browser status bar and RasMol/Chime message box (when displayed). set picking angle
set picking torsion: Returns the torsion angle defined by 4 atoms sequentially selected with the mouse to the browser status bar and RasMol/Chime message box (when displayed). set picking torsion

Atom Expressions [return to Index]
Type of Expression Expressions
(examples)
Comments
wild cards * specifies every atom in the pdb file
as? specifies  asp (aspartic acid) + asn (asparagine)
*.c?? specifies every carbon atom in all groups of molecule
residue ranges 3,16,12 specifies residues numbered 3, 16, & 12 and all atoms comprising these residues
9-20 specifies residues inclusive of those numbered 9-20 and all atoms comprising these residues
primitive expressions cys, glu, arg
or
(cys, glu, arg)
specifies all atoms in all residues named cys, glu, arg, as? where the 3-letter abbreviations correspond to cysteine (cys), glutaminc acid (glu), and arginine (arg)
ser70:a, *p, glu24:1 specifies all atoms in ser residue 90 in chain ":a" plus all atoms in chain "*p" plus all atoms in glu residue 24 in chain "l"
hem:p.fe, *.sg specifies only Fe atoms in all hem (heme) ligands in chain ":p" plus all atoms(*labeled "sg." 
By the nomenclature convention established for pdb files, the atoms designated "sg" are the gamma-sulfur atoms of cys.
comparison operators
=, <, >
atomno=4,atomno=6 specifies those atoms designated 4 and 6 in the pdb file
temperature>=900 specifies all atoms with a temperature factor greater than or equal to 900
Jmol
"monitor" or "measure"
and display distance
monitor (expression) (expression)

measure (expression) (expression)
Examples
1) monitor (atomno=605) (atomno=622);
2) measure (asp194.od1) (ile16.n);
3) measure (asp194) (ile16).
color monitor yellow or color measure yellow colors dotted line and label yellow
By default distances displayed in nm.
set measurements angstroms
changes units
Example 3) returns by default the distance between the alpha-N atoms of the two designated amino acid residues since specific atoms are not specified in the expressions.
Chime
"monitor"
and display distance
monitor 605,622 script command causes display of a dotted line and between atoms 605 and 622 plus a distance label; only atom numbers work; 
color monitor yellow will change color of dotted line which defaults to atom colors.

Boolean  (LOGIC) Operators [return to Index]
Type of Expression Expressions
(examples)
Comments
Boolean
(LOGIC)
Operators
and,
or,
and not
ser90 and *c Specifies all atoms defined as part of serine residue number 90 and also part of the chain "c"
ligand or 196-199 Specifies all atoms in residues defined as part of a (nonprotein) ligand and all atoms comprising residues numbered 196-199
 backbone and notalpha Specifies all atoms defined as part of the backbone but not part of alpha-helical structures
Boolean
(LOGIC)
Expressions

on / true
off / false
hbond{s} on
hbond{s}
false
hbond{s} 50=
connect on
Turns hbonds on
Turns hbonds o
ff
Turns hbonds onwith diameter "50"
Connects abnormal bond lengths

Predefined Expression Sets and Objects [return to Index]
Protein and Nucleic Acid Structure Sets
helix All atoms in a selected set of atoms that conform to alpha-helical polypeptide or double helix DNA structures.
sheet selects all atoms within parallel or anti-parallel polypeptide segments
turn selects all atoms within beta-turn polypeptide segments
Predefined Protein, Nucleic Acid, or "Other" Molecule/Atom Sets
Protein
Nucleic Acid
Other
acidic aliphatic large amino at hydrogen
basic aromatic helix protein cg ions
charged acyclic sheet(s) alpha pyrimidine hetero
neutral cyclic turn buried purinel ligand
polar small sidechain bonded nucleic surface
hydrophobic medium cystine backbone backbone water,hoh,solvent
See Advanced User-Defined Sets below
  • selected
    Example: color selected blue; this colors all atoms in the current selection blue
  • define <identifier> <expression>
    Example: define active (zn,his12). This command gives the name "active" to a grouping of atoms that include a Zn atom and all atoms in the his12 residue.
  • surface <identifier> <color>
    Example: surface outside green; this gives the name "outside" to an opaque surface displayed around whatever atoms are currently selected by previous commands.
  • list <identifier> transparent
    Example: list outside transparent; this changes the displayed opaque surface named "outside" to transparent surface.

Color Command [return to Index]
Example
: color {<object>} <color>
Objects Predefined Colors Atom Color Schemes
backbone cartoon{s} blue black cpk amino
ribbon{s} trace greenblue magenta group chain
dots label{s} red redorange temperature charge
ssbond{s} hbond{s} yellow green shapely structure
atom{s} bond{s} cyan orange user  
axes   violet purple    

Color Schemes [return to Index]
CPK = Corey/Pauling/Kultun atom coloring scheme Amino Acid Colors
carbon gray
[200,200,200]
ASP, GLU bright red [230,10,10]
oxygen red [240,0,0] CYS, MET yellow [230,230,0]
nitrogen lavender [143,143,255] LYS, ARG blue [20,90,255]
hydrogen white [255,255,255] SER, THR orange [250,150,0]
sulfur yellow [255,200,50] PHE, TYR mid-blue [50,50,170]
phosphorous orange [255,165,0] ASN, GLN cyan [0,220,220]
chlorine green [0,255,0] GLY light gray [235,235,235]
calcium, metals dark gray [128,128,144] LEU, VAL, ILE green [15,130,15]
unknown deep pink [255,20,147] ALA dark gray [200,200,200]
Colors are numerically specified by [R#,G#,B#] where each R#(red)G#(green), or B#(blue) number ranges between 0-255.
Black = [0,0,0] & White = [255,255,255]
TRP pink [199,90,180]
HIS pale blue [130,130,210]
PRO flesh [220,150,130]

Screen Capture of a JSMole Image [return to Index]
Use the screen capture function of your computer.  

Advanced Commands and Expressions [return to Index]
Expression or Command
within(<value>,<expression>):  The within expression defines all atoms within a distance = <value> from <expression>.   A decimal <value> specifies ad distance in Angstroms; a digit <value> specifies an arbitrary distance.
  • Note: within(<value>,<expression>) and within (<value>,<expression>) are equally valid expressions where an optional space in the later expression separates within from (<value>,<expression>).
Example
"select within(8.0,asp141) and not asp141" selects all atoms are 8.0 Angstroms from the atoms constituting asp141, excluding asp141 atoms themselves from the selection as specified by the "and not" Boolean operator.
define <identifier> <expression>The define command creates a custom grouping of all atoms in the <expression> and gives the grouping a unique <identifier>. Once defined, the <identifier> itself can be used as an <expression>. Examples
"
define active (his12,his119) and sidechain" This defines a grouping named "active" that includes the sidechain atoms of his12 and his119.  Now if you wanted to color those atoms red, you could issue the command: "color active red."
  • Note: Avoid using a reserved name for the <identifier>; names like "helix," "sheet," "his," etc., are reserved and would give you an error.

isoSurface <saSurface / moleculer / solvent> surface select <identifier> color <{translucent} blue /..>

select <identifier> isoSurface <saSurface / moleculer / solvent> color <{translucent} red /...>

isoSurface off

Note: Avoid using a reserved name for the <identifier>; names like "helix," "sheet," "his," etc., are reserved and would give you an error.

Reference: http://jmol.sourceforge.net/docs/surface/


Move Commands [Return to Index]
Command Argument {optional}
move
{+/-}# {+/-}# {+/-}# {+/-}# {+/-}#  {+/-}# {+/-} # # {#} {#}
Xr Yr Zr Zo  Xt  Yt Zt  Sl  TT {FPS} {MA}
Xrot Yrot Zrot Zoom Xtrans Ytrans Ztrans Slab TotalTime {FPS} {MaxAccel}
 
Screen Action:
Moves the image in the specified direction, for the specified duration at the specified rate.  
Example: move 0 -360 0 10 0 0 0 0 5 60
Rotates image - 360 degrees around Y-axis, and zooms in 10 units in 5 secs. at 60 frames per sec (fps).

PDB File Naming Conventions [return to Index]
See Tutorial on Atom and Group Naming in PDF Files (8)
PDB Name
(case insensitive)
Atom/Group
(only a partial listing)
Examples:  command <expression>
h n
ca
c o
backbone H, N, C-alpha, C, and O atoms joined in peptide bonds select (gly2.h,gly2.n,gly2.ca,gly2.c,gly2.o)
selects gly2 atoms joined in peptide bonds
select backbone and gly2 - an equivalent command
ca
cb
cg
cd
ce
cg1
backbone alpha-C
sidechain beta-C
sidechain gamma-C
sidechain delta-C
sidechain epsilon-C branched sidechain C of val and ile
select *.ca  - selects all a-Cs; equals select alpha
select asp.cb -  selects all asp
b-Cs
select glu141.cg - selects
g-C of glu141
select gln77.cd
- selects
d-C of gln77
select lys30.cg - selects
e-C of lys30
select *.cg1 - selects sidechain C's branched from
b-C's of all val and ile residues
oe1,oe2

od1,od2

od2
oe1

oh
sidechain glu O's

sidechain asp O's

sidechain asn O
sidechain gln O

sidechain tyr O
select glu15.oe? - selects both gamma-carboxylate sidechain O's of glu15
select (*.od1,od2) and asp99 - selects both beta-carboxylate sidechain O's of asp99
select asn10.od2 - selects asn10 sidechain O
select *.oe1 - selects one sidechain O of all glu and gln residues (Note: Both glu & gln have oe1 O atoms.)
select tyr and *.oh - selects all tyr sidechain O's
nz

ne,nh1,nh2

nd1,ne2

nd2

ne2

ne1
sidechain lys epsilon-N

sidechain arg N's

sidechain his N's

sidechain asn N

sidechain gln N

sidechain trp N
select lys101.nz - selects the sidechain e-amino N of lys101
select arg50.n?? and not backbone - selects the 3 sidechain guanidinium N's of arg50
select sidechain and *.n?? and his149 - selects 2 sidechain imidazole N's of his149
select *.nd2 - selects the sidechain N of all asn residues (Note: Only asn has nd2 N atom.)
select *.ne2 - selects one sidechain N of all gln  and  his residues (Note: Both gln & his have ne2 atoms.)
select *.ne1 - selects sidechain N of all trp residues (Note: Only trp has ne1 atom.)
sd
sg
sidechain met S
sidechain cys S
select met44.sd - selects sidechain S of met44
ssbonds on - connects (with a dotted line) sidechain S's of cys pairs forming disulfide bonds
asp###
 etc.
amino acid residue & no. select (asp1,glu) - selects asp and all glu; equals 
select acidic and 1 or glu
protein all atoms making up protein restrict protein - restricts selected atoms only to those making up protein
hetero all non-protein, non-nucleic acid atoms define substrate hetero - defines a custom group named "substrate" including all hetero atoms
nucleic all atoms making up nucleic acids restrict nucleic - restricts selected atoms to just those making up nucleic acids
dna all atoms making up DNA select nucleic and not DNA - selects atoms making up non-DNA nucleic acids, such as RNA

Go to top
© Duane W. Sears
February 17, 2021