Difference between revisions of "Macro"
m |
m |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Tutorials_Sections}} | {{Tutorials_Sections}} | ||
− | = | + | = Introduction to macros in Jmol application = |
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 {{Directory|$HOME/.jmol/macros}} subdirectory. It will show up in the Macro menu of the Jmol application. | 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 {{Directory|$HOME/.jmol/macros}} subdirectory. It will show up in the Macro menu of the Jmol application. | ||
Line 14: | Line 14: | ||
The macro file must be a text file with the extension <code>macro</code>, and its | The macro file must be 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 respectively with "Title=" and "Script=" (only one macro per file). |
− | == | + | Note that macros will be listed in the Jmol application Macros menu alphabetically by file name, not by title. |
− | To show everything as balls-and-sticks | + | |
+ | = Example macros = | ||
+ | |||
+ | ''(feel free to add your own)'' | ||
+ | |||
+ | == Balls & sticks == | ||
+ | To show everything as balls-and-sticks in CPK color, create a text file with this contents: | ||
+ | <pre> | ||
+ | Title=Ball & Stick | ||
+ | Script=select all; color cpk; wireframe only; wireframe 0.15; spacefill 23%; | ||
+ | </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. | ||
+ | |||
+ | == Macromolecules, PDB style == | ||
+ | To show the protein and nucleic acids as cartoons and the ligands as | ||
+ | balls-and-sticks: | ||
+ | <pre> | ||
+ | Title=PDB view | ||
+ | Script=select all; cartoon only; color cartoon chain; | ||
+ | select ligand; wireframe 0.15; spacefill 23%; select all; | ||
+ | </pre> | ||
+ | : (the full script must go in a single line) | ||
+ | |||
+ | == Color according to DRuMS MacroMicro scheme == | ||
+ | To color the current selection 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 ligand; color [x6DFA36]; select solvent; color [x3A79BC]; | ||
+ | select temp; | ||
+ | </pre> | ||
+ | : (the full script must go in a single line) | ||
+ | |||
+ | == Get current orientation == | ||
+ | This would be useful to copy and paste the current orientation of the model into your script. | ||
<pre> | <pre> | ||
− | Title= | + | Title=get orientation |
+ | Script=show orientation moveTo; | ||
+ | </pre> |
Latest revision as of 14:52, 24 July 2014
- A list of Jmol / JSmol Tutorials written by users.
- Using the mouse (English · Español · Français · Japanese).
- Scripting quickstart: rendering options · selecting atoms.
- How to create surfaces and isosurfaces, including cavities, pockets and tunnels.
- Displaying shapes, polyhedra, orbitals, dipoles, distances, forces and vibrations.
- Creating movies.
- Customizing Jmol: macros · menus.
- Web pages without writing code by using the Jmol "Export to Web" function.
Contents
Introduction to macros in Jmol application
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 atc:\Documents and Settings\(yourUserName)\
If you don't find it, try
- My PC > right-click > Properties > Advanced Options (tab) > Environment Variables (button)
- or open a command line and type
set
The macro file must be a text file with the extension macro
, and its
contents must be two lines, starting respectively with "Title=" and "Script=" (only one macro per file).
Note that macros will be listed in the Jmol application Macros menu alphabetically by file name, not by title.
Example macros
(feel free to add your own)
Balls & sticks
To show everything as balls-and-sticks in CPK color, create a text file with this contents:
Title=Ball & Stick Script=select all; color cpk; wireframe only; wireframe 0.15; spacefill 23%;
- (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.
Macromolecules, PDB style
To show the protein and nucleic acids as cartoons and the ligands as balls-and-sticks:
Title=PDB view Script=select all; cartoon only; color cartoon chain; select ligand; wireframe 0.15; spacefill 23%; select all;
- (the full script must go in a single line)
Color according to DRuMS MacroMicro scheme
To color the current selection 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 ligand; color [x6DFA36]; select solvent; color [x3A79BC]; select temp;
- (the full script must go in a single line)
Get current orientation
This would be useful to copy and paste the current orientation of the model into your script.
Title=get orientation Script=show orientation moveTo;