Difference between revisions of "Macro"

From Jmol
Jump to navigation Jump to search
(Jmol Macro's)
Line 9: Line 9:
 
: My PC > right-click > Properties > Advanced options tab > Environment variables  
 
: My PC > right-click > Properties > Advanced options tab > Environment variables  
 
: or open a command line and type <code>set</code>
 
: or open a command line and type <code>set</code>
 
  
 
The macro file is a text file with the extension <code>macro</code>, and its  
 
The macro file is a text file with the extension <code>macro</code>, and its  
 
contents must be two lines, starting with "Title=" and "Script=" (only one macro per file).  
 
contents must be two lines, starting with "Title=" and "Script=" (only one macro per file).  
  
==Example macro:==
+
==Example macro 1==
 +
To show everything as balls-and-sticks, CPK color, create a text file, write this:
 +
<pre>
 +
Title=Ball & Stick
 +
Script=select all; cartoon off; trace off; ribbon off; color cpk;
 +
wireframe 40; spacefill 120
 +
</pre>
 +
: (the full script must go in a single line)
 +
 
 +
and save as <code>ballandstick.macro</code> (or the name you like) in the folder {{Directory|$HOME/.jmol/macros}}
  
 +
Then to use it, open Jmol application, open menu "Macros", and there you will have a "Ball & Stick" entry.
 +
 +
==Example macro 2==
 
To show the protein and nucleic acids as cartoons and the ligands as  
 
To show the protein and nucleic acids as cartoons and the ligands as  
balls-and-sticks, create a text file, write this:
+
balls-and-sticks:
 
<pre>
 
<pre>
 
Title=PDB view
 
Title=PDB view
Line 23: Line 34:
 
select ligand; wireframe 40; spacefill 120
 
select ligand; wireframe 40; spacefill 120
 
</pre>
 
</pre>
and save as <code>macromol.macro</code> (or the name you like) in the folder {{Directory|$HOME/.jmol/macros}}
+
: (the full script must go in a single line)
  
Then to use it, open Jmol application, open menu "Macros", and there you will have a "PDB view" entry.
+
==Example macro 3==
 +
To color everything using [http://www.umass.edu/molvis/drums/ DRuMS] "macromolecule" color scheme (slightly adapted to account for Jmol's capabilities):
 +
<pre>
 +
Title=color MacroMicro
 +
Script=define temp selected; select protein; color [xCBBE8A];
 +
select dna; color [xAE00FE]; select rna; color [xFD0162];
 +
select calcium, not (protein, nucleic, water); color [x6DFA36];
 +
select solvent; color [x3A79BC]; select temp
 +
</pre>
 +
: (the full script must go in a single line)

Revision as of 16:47, 24 May 2006

Jmol Macro's

A Jmol macro is a small script that provides some reusable functionality for the Jmol Application. It is saved as a simple text file, like any other script, in the $HOME/.jmol/macros subdirectory. It will show up in the Macro menu of the Jmol application.

Windows: the $HOME folder's location is stored in the environment variable %USERPROFILE% or in the environment variables %HOMEDRIVE% and %HOMEPATH%; it will usually be at c:\Documents and Settings\(yourUserName)\

If you don't find it, try

My PC > right-click > Properties > Advanced options tab > Environment variables
or open a command line and type set

The macro file is a text file with the extension macro, and its contents must be two lines, starting with "Title=" and "Script=" (only one macro per file).

Example macro 1

To show everything as balls-and-sticks, CPK color, create a text file, write this:

Title=Ball & Stick
Script=select all; cartoon off; trace off; ribbon off; color cpk; 
wireframe 40; spacefill 120
(the full script must go in a single line)

and save as ballandstick.macro (or the name you like) in the folder $HOME/.jmol/macros

Then to use it, open Jmol application, open menu "Macros", and there you will have a "Ball & Stick" entry.

Example macro 2

To show the protein and nucleic acids as cartoons and the ligands as balls-and-sticks:

Title=PDB view
Script=select all; spacefill off; wireframe off; cartoon; color cartoon chain; 
select ligand; wireframe 40; spacefill 120
(the full script must go in a single line)

Example macro 3

To color everything using DRuMS "macromolecule" color scheme (slightly adapted to account for Jmol's capabilities):

Title=color MacroMicro
Script=define temp selected; select protein; color [xCBBE8A]; 
select dna; color [xAE00FE]; select rna; color [xFD0162]; 
select calcium, not (protein, nucleic, water); color [x6DFA36]; 
select solvent; color [x3A79BC]; select temp
(the full script must go in a single line)