Difference between revisions of "Jmol-Application/C2/Script-Console-and-Script-Commands/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with ''''Title of script''': Script console and Script commands '''Author: Snehalatha Kaliappan''' '''Keywords: '''Script documentation, script commands, Molecular visualization, 3D …')
 
 
Line 25: Line 25:
 
* Change display of model by using '''script commands'''
 
* Change display of model by using '''script commands'''
 
* Display lines of text on the '''panel'''  
 
* Display lines of text on the '''panel'''  
 
 
  
 
|-
 
|-
Line 50: Line 48:
 
* '''Jmol v'''ersion 12.2.2
 
* '''Jmol v'''ersion 12.2.2
 
* '''Java''' version 7  
 
* '''Java''' version 7  
 
 
  
 
|-
 
|-
Line 58: Line 54:
 
'''Modify Display in Jmol Application'''
 
'''Modify Display in Jmol Application'''
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Display on '''Jmol''' '''panel '''can be modified using  
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Display on '''Jmol''' '''panel '''can be modified using  
 
 
* Options in Menu bar  
 
* Options in Menu bar  
* Options in the Pop-up-menu or by
+
* Options in the Pop-up-menu or
* '''Scripting commands '''on the script '''console'''.
+
* by '''Scripting commands '''on the script '''console'''.
 
+
 
+
  
 
|-
 
|-
Line 79: Line 72:
  
  
'''Script commands''' control the display of a '''model''' on panel
+
'''Script commands''' control the display of a '''model''' on '''panel'''
  
  
Line 93: Line 86:
  
 
[http://chemapps.stolaf.edu/jmol/docs/ http://chemapps.stolaf.edu/jmol/docs/]  
 
[http://chemapps.stolaf.edu/jmol/docs/ http://chemapps.stolaf.edu/jmol/docs/]  
 +
 +
|-
 +
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide Number 8'''
 +
 +
'''Using commands.'''
 +
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| 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'''.'''
  
 
|-
 
|-
Line 105: Line 113:
 
|-
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on the ''''File'''' menu in the menu bar.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on the ''''File'''' menu in the menu bar.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To open a '''Script''' '''console''' window, click on '''File''' menu in the menu bar.
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To open a '''Script console''' window, click on '''File''' menu in the menu bar.
  
 
|-
 
|-
Line 137: Line 145:
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on 'Jmol script console' window.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on 'Jmol script console' window.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us now try to write a few simple s'''cript commands. '''
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us now try to write a few simple s'''cript commands. '''
 
 
 
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide Number 8'''
 
 
'''Using commands.'''
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| How to write 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'''.'''
 
  
 
|-
 
|-
Line 167: Line 157:
  
 
'''Script commands '''start with a '''command word'''.
 
'''Script commands '''start with a '''command word'''.
 
 
 
  
 
|-
 
|-
Line 191: Line 178:
 
|-
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"|  
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"|  
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| I am using Kmag screen magnifier to magnify the console.
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| I am using '''Kmag screen magnifier''' to magnify the '''console'''.
  
 
|-
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on 'Jmol script console' window.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on 'Jmol script console' window.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For example, to change the color of all the '''carbons''' in '''propane,''' to orange''':'''  
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For example, to change the color of all the '''carbons''' in '''propane,''' to orange; place the cursor on the '''Script Console''' window.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| After the $ prompt type '''select carbon;color atoms orange '''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| At the '''$ prompt''' type '''select carbon;color atoms orange '''
  
 
'''>>'''Press '''Enter''' key  
 
'''>>'''Press '''Enter''' key  
  
 
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the '''dollar prompt, '''type
 
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Place the cursor on the '''Script console''' window.
+
 
+
 
+
At the '''dollar prompt, '''type
+
  
 
'''select carbon;color atoms orange'''
 
'''select carbon;color atoms orange'''
Line 216: Line 198:
 
|-
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on Jmol panel.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on Jmol panel.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''Propane''' model on the panel, now has all the carbons in orange color.  
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''Propane''' model on the panel, now has all the '''carbons''' in orange color.  
  
 
|-
 
|-
Line 259: Line 241:
  
  
Note the change in size of the bonds in the Propane model.
+
Note the change in size of the bonds in the '''Propane''' model.
  
 
|-
 
|-
Line 268: Line 250:
  
 
'''>> '''Press '''Enter'''
 
'''>> '''Press '''Enter'''
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Similarly to increase the size of bonds.
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Similarly, to increase the size of bonds, at the '''prompt''', type '''wireframe 0.1'''
 
+
 
+
At the '''prompt''', type '''wireframe 0.1'''
+
  
  
Line 284: Line 263:
  
 
>> Press '''Enter'''
 
>> Press '''Enter'''
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To change the size of atoms we will use the command '''spacefill f'''ollowed by a decimal number.
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To change the size of atoms, we will use the command '''spacefill''' followed by a decimal number.
  
  
At the '''dollar prompt, '''write '''spacefill 0.2'''
+
At the '''dollar prompt, '''type '''spacefill 0.2'''
  
  
Line 296: Line 275:
 
|-
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on 'Jmol panel'.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Cursor on 'Jmol panel'.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Observe the size of atoms in the propane molecule decrease in size.
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Observe the size of atoms in the '''propane''' molecule decrease in size.
  
 
|-
 
|-
Line 304: Line 283:
  
 
Press ''''Enter'''' key on the key board.
 
Press ''''Enter'''' key on the key board.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Similarly to increase the size of the atoms type:
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Similarly, to increase the size of the atoms type:
  
  
Line 319: Line 298:
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Alternately, we can also use command '''cpk''' followed by percentage or decimal number.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Alternately, we can also use command '''cpk''' followed by percentage or decimal number.
  
The percentage represents the vandewaal's
+
The percentage represents the '''vanderwaal''''s radius of the atom.
 
+
radius of the atom.
+
  
 
|-
 
|-
Line 328: Line 305:
  
  
Note the change in size of the atoms.
+
Note the change in the size of the atoms.
  
 
|-
 
|-
Line 345: Line 322:
  
 
Type ''''set echo top center;echo Propane'''' >> Press '''Enter'''
 
Type ''''set echo top center;echo Propane'''' >> Press '''Enter'''
 
 
  
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For example, we will display the name of the molecule as ''''Propane'''' at the top center of the '''panel'''.
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For example, we will display the name of the molecule as ''''Propane'''' at the top center of the '''panel'''.
Line 391: Line 366:
  
 
After the $ prompt type ''''font echo 30 Arial italic' '''>> Press '''Enter'''
 
After the $ prompt type ''''font echo 30 Arial italic' '''>> Press '''Enter'''
 
 
  
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For example, I want the text to be in '''Arial Italic '''font.  
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For example, I want the text to be in '''Arial Italic '''font.  
Line 439: Line 412:
 
* Change the display properties of the model, by using '''script commands''' and
 
* Change the display properties of the model, by using '''script commands''' and
 
* Display lines of text on the '''panel.'''
 
* Display lines of text on the '''panel.'''
 
 
  
 
|-
 
|-
Line 455: Line 426:
 
* Change the color of all the bonds to '''red'''
 
* Change the color of all the bonds to '''red'''
 
* Set the molecule to spin on screen.
 
* Set the molecule to spin on screen.
 
 
  
 
|-
 
|-

Latest revision as of 16:22, 14 March 2014

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