Jmol-Application/C4/Animation-using-Script-Commands/English

From Script | Spoken-Tutorial
Revision as of 15:54, 14 August 2015 by PoojaMoolya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Visual Cue
Narration
Slide Number 1

Title Slide

Welcome to this tutorial on Animation using Script Commands.
Slide Number 2

Learning Objectives

In this tutorial, we will learn to show animations using Jmol script commands.

For demonstration we will use models of

ethane and hemoglobin as examples.

Slide Number 3

Learning Objectives

Jmol script commands with the following keywords will be used for animations.


Move, delay, slab, loop and capture.

Slide Number 4

Pre-requisites

To follow this tutorial you should have knowledge of,

High School Chemistry

And familiar with operations from Jmol window.

If not, for relevant tutorials, please visit our website.

Slide Number 5

System Requirement

To record this tutorial I am using

Ubuntu OS version. 14.10

Jmol version 14.1.11

And Java version 7

Slide number 6

Animation commands

This slide shows the function of each animation command in detail.
Slide Number 6

Animation commands

move command allows you to rotate, zoom and translate a model within a specified period of time.

delay command is used to pause a script for the specified number of seconds

Slab command is used to control the percentage of the molecule to be displayed on panel.

Slide Number 7

Animation commands

loop command causes the script to restart

at the beginning, with an optional

time delay .

capture command captures animations as animated GIF files.

For more details on Jmol script command:

visit the web page for Jmol interactive script documentation

Cursor on the slide Number 7 Let us open the Jmol window and demonstrate an animation using move command.
Cursor on Jmol panel. I will begin with a simple move command using ethane as an example.

Create a model of ethane using modelkit menu.

Click on the modelkit icon, then click on hydrogen. Click on the modelkit icon, a model of methane appears on the screen.

Click on the hydrogen. Now we have a model of ethane on screen.

Open the console using file menu.
At the prompt type,

move 0 360 0 -30 0 20 0 0 5

Press enter.

At the prompt type the following command.

The command line starts with the word move.

Followed by numbers that quantify a set of animation parameters.

Slide Number 8

Move command

move [x-rotation] [y-rotation] [z-rotation] [zoom-factor] [x-translation] [y-translation] [z-translation] [slab-cutoff] [seconds-total]

More information about move command.

There are nine parameters in the move command.

Cursor on the slide Number 8 The First three parameters are rotations around X, Y and Z axes.

4th is the zoom modifier, expressed in positive or negative numbers.

Positive for zoom in and negative for zoom out.

The next three parameters deal with translation along the three axes.

Cursor on the slide Number 8 8th is the slab parameter. Slab "slices" the molecule.

It removes atoms to a specified depth so that interior features may be easily observed.

Cursor on the slide Number 8 Parameter 9 is the amount of time, in seconds, taken in performing the move command.

Back to the Jmol Panel.

Cursor on the panel Press enter and observe the panel.
Cursor on the console. We can create more interesting animation by adding more commands to the existing one.

Press up arrow key on the key board to get the previous command.

Cursor on the console. Type delay space 2 after the semicolon.

Here the delay command pauses the script for 2 seconds, before executing the next command.

At the prompt type,

move 0 360 0 -30 0 20 0 0 5; delay 2; move 0 360 0 30 0 -20 0 0 5;

Then type another move command after this delay command.

Don't forget to add semicolon at the end of each keyword command.

press enter

Cursor on the panel.


Cursor on the panel.

Observe the panel.

We can also change the color of the atoms during this animation.

Again press up arrow key to get the previous command.

At the prompt type,

move 0 360 0 -30 0 20 0 0 5; delay 2; select hydrogen; color yellow; select carbon; color green; move 0 360 0 30 0 -20 0 0 5;

Highlight the command.

Edit the command as I have shown here on the console.

Use select key words to change the color of the hydrogens and carbons.

press enter

Cursor on the panel. Again observe the panel.
Cursor on the panel Add a slab command to make certain parts of the molecule to disappear and appear.
Cursor on the console. Press up arrow key again and edit the previous command as shown on the console.
At the prompt type,

move 0 360 0 -30 0 20 0 0 5; delay 2; select hydrogen; color yellow; select carbon; color green; slab on; slab 50; move 0 360 0 30 0 -20 0 0 5; slab off.

Type slab on after the select command.

Type slab off at the end of the command.

Press enter and observe the panel.

You can see parts of the molecule disappear and appear again.

Cursor on the console. You can save this animation as a GIF file using capture key word.

Press up arrow key to get the previous command.

Type the capture command and specify the file name and path at the beginning of the command.

You can type the name of your home folder to save the GIF file.

Cursor on the console.

Type,

Capture “/home/spoken-5/Desktop/sneha” move 0 360 0 -30 0 20 0 0 5; delay 2; select hydrogen; color yellow; select carbon; color green; slab on; slab 50; move 0 360 0 30 0 -20 0 0 5; slab off;

I am saving this animation as file “sneha” on the desktop.

Press enter.

Cursor on the console. Now the animation will be saved as GIF file on my desktop.
Cursor on the desktop. Navigate to location of the GIF file.


Open the saved GIF file with image viewer software.

Cursor on the panel. Back to the Jmol panel.
Cursor on the console. Similarly open a pdb file of any macromolecule; for example oxygenated hemoglobin with a pdb code 2DN1.
Click on file menu, scroll down and click on “Get PDB”. Download the structure directly from pdb database using file menu.

Type the pdb code in the text box, 2DN1.

Press ok.

Cursor on the panel. A model of hemoglobin is displayed on the panel.
Type,

select all; color red; cartoons; select HEM; color yellow; spacefill; delay 2; slab on; slab 50; delay 1; move 90 0 0 0 0 0 0 0 4; delay 1; slab off;

Type the following command in the Console .
Cursor on the console. We have used select keyword command to change the color of different units of the protein.

We have also used move command.

Cursor on the console. This command will display protein in red cartoons.

The Haem part in yellow spacefill display and cut away 50% of the molecule.

Rotate 360º on X axis in 4 seconds and restore all atoms.

Press enter. Press enter and observe the panel.
Type,

select all; color red; cartoons; select HEM; color yellow; spacefill; delay 2; slab on; slab 60; delay 1; move 90 0 0 0 0 0 0 0 4; delay 1; slab off; loop 2;

Let us now use the loop command to repeat all the above steps.

Press up arrow key to get the same command.

Type loop 2 at the end of the command.

"loop 2" indicates the previous script commands will be repeated after a 2 second delay.

press enter

Cursor on the panel. You can be creative and type many more such commands to animate.
Slide Number 9

Summary

Lets summarize,

In this tutorial we have learnt to,

Create animation of ethane and haemoglobin

using script commands such as move, delay.

We have also made use of loop and slab commands.

Saved the animations as a GIF file using capture command.

Slide Number 10

Assignment

For the assignment,
  • Take a molecule of your choice and create animation using move and delay commands.
  • Change display, color and size of the bonds to create animation.
Slide Number 11

Title: About the Spoken Tutorial Project

The video at the following link summarizes the Spoken Tutorial project.

Please download and watch it.

Slide Number 12

Title: Spoken Tutorial Workshops

The Spoken Tutorial Project Team conducts workshops and gives certificates for those who pass an online test.

For more details, please write to us.

Slide Number 13

Title: Acknowledgement

Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.

More information on this Mission is available at the link shown.

Slide Number 13

Title: Acknowledgement

This is Snehalatha from IIT Bombay signing off. Thank you for joining.

Contributors and Content Editors

PoojaMoolya, Snehalathak