Scripting

From Jmol
Revision as of 21:07, 28 March 2006 by NicolasVervelle (talk | contribs) (Initialization from JmolWiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Jmol Scripting

Documentation of Jmol's scripting language can be found here:

An introduction to Jmol scripting is available here:

The following pages are read only versions of the online documentation webpage. Don't edit them; they are autogenerated. But comments are welcomed:

  • JmolScriptHelp
  • ScriptAnimationoranim

The Jmol Application and Applet have a command language that closely resembles the command language of the browser plugin MDL Chime. A set of commands is called a command script, and writing such sets of commands or scripts is called scripting.

Chime's command language (see "About Chime" at http://molviz.org) is a superset of the command language of Roger Sayle's public domain application RasMol. (The command language of open-source RasMol has diverged somewhat from that in RasMol and Chime).

CONNECT implementation

10.00.49 will have the following implementation: (Bob Hanson hansonr@stolaf.edu)

select (atom expression)
connect <min distance> <max distance> <option STATIC> <bond type> (target atom expression)

where <bond type> includes SINGLE, DOUBLE, TRIPLE, AROMATIC, HBOND, DELETE

properties:

  • Bonds that are already made are revised.
  • Bonds are introduced exactly as desired, not just as single bonds.
  • Actions are independent of the setting of BONDMODE

rationale/comments:

  1. You can be as specific as you want in selecting the atom sets and now the distance range, so that suggests to me that there should be no surprises. The command does just what it says and not "connect-unless-not-already-connected."
  2. It needs no dependency upon BONDMODE because the distance ranges -- that typically really do define bond order -- are the determining factors.
  3. It is also more flexible than using BONDMODE, because now we have a specific starting set and a target set between which bonds will be built or removed.
  4. The STATIC parameter indicates to only operate on atoms that are already connected.

examples:

select (carbon)
connect 1.3 1.5 DOUBLE (oxygen)
connect 1.5 1.7 SINGLE (oxygen)
connect 1.7 1.9 DELETE (oxygen)

connect STATIC DOUBLE (oxygen)

SEE THE EXAMPLE AT http://www.stolaf.edu/people/hansonr/jmol/test/json/connect.htm

BONDORDER implementation

An earlier implementation of something like this, "bondorder", created or removed bonds based on the setting of BONDMODE. The difference between bondorder and connect is that bondorder only acts on bonds ALREADY defined. While this could be useful, a simple parameter "STATIC" to the connect command does the same thing. We are thus planning to remove the BONDORDER command. (It was never documented, anyway.)

-Bob Hanson