Welcome to this tutorial on Script console and script commands in Jmol Application.
In this tutorial, we will learn:
About script commands
How to use script console window
Change display of the model by using script commands
Display lines of text on the panel.
To follow this tutorial,
you should know how to,create and edit molecular models in Jmol Application.
If not, watch the relevant tutorials available on our website.
To record this tutorial, I am using:
Ubuntu OS version 12.04
Jmol version 12.2.2
Java version 7.
Display on Jmol panel can be modified using:
Options in Menu bar
Options in the Pop-up-menu or
by Scripting commands on the script console.
We had learnt to modify display using menu bar and pop-up-menu in earlier tutorials.
In this tutorial, we will learn to use script commands.
A set of commands is called a script command.
Script commands control the display of a model on panel.
Jmol uses a command language, based on RasMol program.
Writing such commands is called scripting.
Documentation of Jmol's scripting language and list of commands is available at this link: http://chemapps.stolaf.edu/jmol/docs/
Now, how to use script commands?
Script commands are typed on the “Script console” window.
Script console is the command line interface of Jmol.
It is available on the menu bar, under File and Console option.
This is Jmol Application window with a model of propane on screen.
Let us now learn to use Script console to change the display.
To open a Script console window, click on File menu in the menu bar.
In the drop-down, scroll down and click on Console.
Jmol script console window opens on the screen.
Script console window has a text area to type the commands.
At the bottom of the window, there is a button to open the Script editor window.
Other buttons, namely, Variables, Clear, History and State are also present on this window.
Click on the Help button to open a page showing a list of available script commands.
Click on OK button to close this window.
Let us now try to write a few simple script commands.
How to write these commands?
Type the command after the $ (dollar)prompt, on the Script console window.
Script commands start with a command word,
continues with a set of parameters separated by spaces
and is terminated by the end of line character or semicolon.
The command line will appear red, until you have completed typing the command.
Press Enter key on the keyboard to activate the command.
I am using Kmag screen magnifier to magnify the console.
For example, to change the color of all the carbons in propane to orange- place the cursor on the Script Console window.
At the dollar prompt, type: select carbon semicolon color atoms orange
Press Enter key on the keyboard.
The Propane model on the panel, now, has all the carbons in orange color.
Now, to change the color of all bonds to blue-
At the dollar prompt, type:
select all bonds semicolon color bonds blue
press Enter.
Observe that all the bonds in the propane model are now blue in colour.
Next, let us change the size of bonds.
At the dollar prompt, type: wireframe 0.05
The decimal number is used to specify the radius of the bonds, in angstroms. Press Enter.
Note the change in the size of the bonds, in the Propane model.
Similarly, to increase the size of the bonds, at the prompt, type: wireframe 0.1
Once again, note the change in the size of the bonds.
To change the size of the atoms, we will use the command spacefill followed by a decimal number.
At the dollar prompt, type: spacefill 0.2.
The decimal number represents the radius of the atom in angstroms.
Press Enter.
Observe the size of the atoms in the propane molecule decrease in size.
Similarly, to increase the size of the atoms, type:
spacefill 0.5
Press Enter.
You can see the change in size of the atoms.
Alternately, we can also use command cpk followed by percentage or decimal number.
The percentage represents the vanderwaals radius of the atom.
For example, type: cpk 20% and press Enter.
Note the change in the size of the atoms.
It is possible to write commands, to display lines of text on the Jmol panel.
The command line for the text starts with 'set echo'.
It is followed by the position of the text on the screen.
For example, we will display the name of the molecule as 'Propane' at the top center of the panel.
So, type: set echo top center semicolon echo Propane and press Enter.
We can see the text "Propane", displayed at the top center of the panel.
We can also display other lines of text on the panel.
For example, I want some text in the bottom left corner of the panel.
At the dollar prompt,
type: set echo bottom left semicolon echo This is a model of Propane.
Press Enter.
We can see the text line at the bottom left corner of the panel.
It is also possible to change the color, size and font of the displayed text.
For example, I want the text to be in Arial Italic font.
At the dollar prompt ($), type: font echo 20 Arial italic
Press Enter,This will convert the text to 'Arial Italic' font.
To change the color of the text, we will use color echo followed by name of the colour.
So, type: "color echo yellow" and press Enter.
Note the change in font colour.
Likewise, you can explore many more commands and observe the changes.
Let's Summarize:
In this tutorial, we have learned about:
Script Commands and
Script Console,We also learned to:
Change the display properties of the model by using script commands and
Display lines of text on the panel.
As an assignment-
Create a model of 3-methyl-pentane.
Use script commands to do the following.
Change the color of all the hydrogens to blue.
Change the color of all the bonds to red
and set the molecule to spin.
Watch the video available at this URL: http://spoken-tutorial.org/What_is_a_Spoken_Tutorial
It summarizes the Spoken Tutorial project.
If you do not have good bandwidth, you can download and watch it.
The Spoken Tutorial Project team:
Conducts workshops using spoken tutorials.
Gives certificates to those who pass an on-line test.
For more details, please write to: contact@spoken-tutorial.org
Spoken Tutorial project is a part of the Talk to a Teacher project.
It is supported by the National Mission on Education through ICT, MHRD, Government of India.
More information on this mission is available at this link: http://spoken-tutorial.org/NMEICT-Intro
This is Snehalatha from IIT Bombay, signing off. Thank you for joining.