Jmol-Application/C2/Script-Console-and-Script-Commands/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Title of script: Script console and Script commands

Author: Snehalatha Kaliappan

Keywords: Script documentation, script commands, Molecular visualization, 3D models of chemical structures, Video tutorial

Visual Cue
Narration
Slide Number 1

Title Slide

Welcome to this tutorial on Script console and script commands in Jmol Application.
Slide Number 2

Learning Objectives

In this tutorial, we will learn
  • About script commands
  • How to use script console window
  • Change display of model by using script commands
  • Display lines of text on the panel
Slide Number 3

Pre-requisites

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.

Slide Number 4

System Requirement

To record this tutorial I am using
  • Ubuntu OS version. 12.04
  • Jmol version 12.2.2
  • Java version 7
Slide Number 5

Modify Display in Jmol Application

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.
Slide number 5

Modify Display in Jmol Application

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.

Slide Number 6Script command A set of commands is called Script command.


Script commands control the display of a model on panel


Jmol uses a command language, based on RasMol program.

Slide Number 7

Script commands continued

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/

Slide Number 8

Using commands.

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.

Switch to Jmol panel.

Cursor on panel

This is Jmol Application window with a model of propane on screen.


Let us now learn to use Script console to change the display.

Click on the 'File' menu in the menu bar. To open a Script console window, click on File menu in the menu bar.
Click on 'Console' in the drop-down menu In the drop-down, scroll down and click on Console.
Cursor on 'Jmol script console' window. Jmol script console window opens on the screen.
Cursor on 'Jmol script console' window. Script console window has a text area to type the commands.
Click on 'Editor', Variables, History and State. 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 'Help' button. Click on the Help button to open a page showing a list of available script commands.
Click on 'OK' button. Click on OK button to close this window.
Cursor on 'Jmol script console' window. Let us now try to write a few simple script commands.
Slide Number 9

How to write Commands

How to write these commands:


Type the command after the $ prompt on the Script console window.


Script commands start with a command word.

Slide Number 10

How to write Commands

Continues with a set of parameters separated by spaces.


And is terminated by the end of line character or semicolon.

Slide Number 11

How to write Commands

The command 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.
Cursor on 'Jmol script console' window. For example, to change the color of all the carbons in propane, to orange; place the cursor on the Script Console window.
At the $ prompt type select carbon;color atoms orange

>>Press Enter key

At the dollar prompt, type

select carbon;color atoms orange


Press Enter key on the keyboard.

Cursor on Jmol panel. The Propane model on the panel, now has all the carbons in orange color.
After the $ prompt type

select all bonds;color bonds blue

>> Press Enter key


Now to change the color of all bonds to blue.


At the dollar prompt, type

select all bonds;color bonds blue

Press Enter.

Cursor on Jmol panel. Observe that all the bonds in propane model are now blue in colour.
Cursor on 'Jmol script console' window.


At the $ prompt type

wireframe 0.05.


>> Press Enter

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 bonds, in angstroms. Press Enter.


Note the change in size of the bonds in the Propane model.

Cursor on 'Jmol script console' window.


At the $ prompt type wireframe 0.1

>> Press Enter

Similarly, to increase the size of bonds, at the prompt, type wireframe 0.1


Once again, note the change in size of the bonds.

In 'Jmol script console' window.


At the $ prompt type 'spacefill 0.2'


>> Press Enter

To change the size of atoms, we will use the command spacefill followed by a decimal number.


At the dollar prompt, type spacefill 0.2


The decimal number represents radius of the atom, in angstroms.

Press Enter.

Cursor on 'Jmol panel'. Observe the size of atoms in the propane molecule decrease in size.
Cursor on 'Jmol script console' window.

After the dollar prompt type 'spacefill 0.5'

Press 'Enter' key on the key board.

Similarly, to increase the size of the atoms type:


spacefill 0.5

Press Enter.

Cursor on the panel. You can see the change in size of the atoms.
Cursor on 'Jmol script console' window. Alternately, we can also use command cpk followed by percentage or decimal number.

The percentage represents the vanderwaal's radius of the atom.

Type 'cpk 25%' >> Press Enter For example, type cpk 20% and press Enter.


Note the change in the size of the atoms.

Cursor on 'Jmol script console' window. It is possible to write commands, to display lines of text on the Jmol panel.
The command line for text starts with 'set echo'.


It is followed by the position of the text, on the screen.

Cursor on 'Jmol script console' window.

Type 'set echo top center;echo Propane' >> Press Enter

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;echo Propane

and press Enter.

Cursor on the panel. We can see the text 'Propane' displayed at the

top center of the panel.

Cursor on 'Jmol script console' window. 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.

In 'Jmol script console' window.

After $ prompt type 'set echo bottom left; echo This is a model of Propane' >> Press Enter

At the dollar prompt,

type set echo bottom left; echo This is a model of Propane


Press Enter.

Cursor on the panel. We can see the text line at the bottom left corner of the panel.
Cursor on 'Jmol script console' window. It is also possible to change the color, size and font of the displayed text.
Cursor on 'Jmol script console' window.

After the $ prompt type 'font echo 30 Arial italic' >> Press Enter

For example, I want the text to be in Arial Italic font.


At the dollar prompt Type font echo 30 Arial italic


This will convert the text to 'Arial Italic' font.

In 'Jmol script console' window.


After $ prompt type

'color echo yellow' >> Press Enter

To change color of the text, we will use color echo followed by name of the colour.


At the prompt, type color echo yellow and press Enter.


Note the change in font colour.

Cursor on 'Jmol script console' window. Likewise, you can explore many more commands and observe the changes.


<PAUSE>

Slide Number 12

Summary

Let's Summarize:

In this tutorial we have learnt about:

  • Script Commands and
  • Script Console

We also learnt to

  • Change the display properties of the model, by using script commands and
  • Display lines of text on the panel.
Slide Number 13

Assignment

As an assignment

Create a model of 3-methyl-pentane.

Use script commands to do the following.

  • Change the color of all hydrogens to blue.
  • Change the color of all the bonds to red
  • Set the molecule to spin on screen.
Slide Number 14

Acknowledgement

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

Slide Number 15 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

Slide number 16 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.

Contributors and Content Editors

Nancyvarkey, Snehalathak