Shortening Scripts Saved from RasMol or Chime

Saving Scripts

RasMol's save script command writes a script file containing a series of commands which will reproduce the image present at the time the script was saved. Chime has the same capability inherited from Roger Sayle's source code for RasMol. Details on how to use and troubleshoot this powerful feature are available in Scripts saved from RasMol do not include:

Also, Chime does not properly obey the background command in RasMol-saved scripts when background colors other than black are specified.

At my request, Tim Maffett was kind enough to fix four of these five limitations in scripts saved from Chime version 2.0. (He didn't fix the dot surfaces because I hadn't discovered this bug in RasMol at the time. Dot commands can be added to the scripts after they are saved to generate any desired dot surfaces.)

Scripts saved from Chime contain a few commands which don't exist in RasMol. Nevertheless, Chime-saved scripts run satisfactorily in RasMol. RasMol emits error messages about the commands it does not recognize, but proceeds through the entire script.

Unnecessary Length of Scripts Saved from RasMol or Chime

Scripts saved from RasMol or Chime tend to be unnecessarily long. Such scripts may take on the order of a full minute to execute in the Protein Explorer in default mode, where messages are discarded. If you request that all the script commands be echoed to the message box, unscrambling of the message stream can take more than 15 minutes! Even in RasMol, with large molecules and complex images, the RasMol-saved script can sometimes take minutes to generate the image.

The reason that these scripts are so long is that they often contain hundreds of select commands, each followed by rendering and coloring commands. In the worst cases, selection proceeds atom by atom.

Shortening Scripts Saved from RasMol or Chime

Most sections of these scripts execute quickly. As mentioned above, it is the section containing the selection, rendering, and coloring commands which is unnecessarily long -- a section subtitled # Atoms. Therefore one can shorten such scripts greatly by editing them to replace the unnecessarily numerous commands with simpler commands which do the same job. A concrete example will best illustrate how to do this.

I generated an image in the Protein Explorer, and then I saved a script. In RasMol, the same example could be used with a few minor modifications. The PDB file employed, 105D, contains eight models of an unusual DNA structure obtained from NMR analysis. After I experimented with different commands to get an image I liked, I summarized the commands needed to select, render, and color the desired atoms as follows:

  wireframe 0.2
  select t
  color yellow
  select c
  color red
  select backbone
  color white
  select phosphorus
  color cpk
  spacefill 0.8
  restrict model=1 and not hydrogen
Before saving the script, I had used the mouse to set an orientation and zoom which I liked. The saved script contained 1,142 lines and began as follows:
  #!rasmol -script
  # File: \s3vv9qel.
  # Creator: Chime Version 2.0
  set load check on
  load pdb "105d.pdb"
  background [255,255,255]
  set ambient 60
  set specular off
  slab off
  rotate z 171
  rotate y -80
  rotate x -172
  translate x 1
  zoom 167

  center all
  translate center center
  set zoom center true
  set bonds off
  set axes off
  set boundingbox off
  set unitcell off
  set bondmode and
  dots off
I deleted everything after the above commands and added the above "summary" commands, making a script file with only 39 lines. On my computer the Chime-saved, 1,142-line script took 20 seconds to generate an image, plus another 20 seconds before the PE became "ready" (with Message Control: Scripts called from the command slot unchecked!), a total of over 40 seconds. In contrast, the manually modified script took less than 3 seconds to produce the same image and become "ready".

In some cases, in order to achieve the desired result, you may need to replace just the # Atoms section with your summary commands, preserving the sections at the end entitled

  # Ribbons
  # Backbone
  # Labels
  # Monitors
  # Definitions
  # Current Selection