Custom Scripting NMR Models/Animations

The default rendering of NMR models shows proteins, DNA, and RNA as thin backbone traces colored by N->C rainbow ("color group", amino/5' terminus blue, carboxy/3' terminus red). Ligand atoms are shown spacefilled in Corey-Pauling-Koltun colors. Any atoms which are not protein, DNA, RNA, nor designated hetero, are shown in ball and stick.

Additonal displays and color schemes can be selected with the radio buttons. Each press of a radio button automatically generates a corresponding script in the box, and automatically runs the [All] routine. The new script is used by the [All] and [Animate] buttons. However, the [Model+][-] buttons will preserve colors that are applied by entering commands manually, while using the display specified by the radio buttons.

If you want a display or color scheme that is not produced by any combination of the radio buttons, you can manually edit the script in the box. Once edited, this script will be preserved for the duration of the PE session. Even when you leave the NMR Models/Animation page, when you return to it, the edited script will be restored to the box. When you end the PE session, your edited script will be lost. You may wish to copy it to a text file, from which you can later paste it back into the NMR script box in a new PE session.

In the Protein Comparator, separate scripts can be specified for the top and bottom molecules. Whichever molecule is selected, the appropriate script will be displayed in the box, and applied.

Before editing the script, you should choose the radio buttons that come closest to what you want. These will generate a script in the box that you can then edit. Often only a handful of changes are needed. After editing the script, if you press a radio button, you will be given the option to cancel it in order to preserve your edited script.

Easy changes

Minor changes to the default script are easily accomplished. For example, if you don't want ligand to show, in the script box, simply delete the commands

Or, to change ligand to ball and stick, replace the above-referenced spacefill command with Or, to show the position of a ligand that is present only in the last model througout the animation, insert these commands immediately before the comment "#--End color scheme--": (The "30" means 30% of the default dot density. You can experiment with different values to get the desired dot density.)

Initialization vs. Loop Blocks and Boundary Marker #$

The script is divided into two blocks. The first or initialization block is run only once at the beginning of an animation, and primarily establishes the color scheme. The second block in the script is the loop block. In an animation, the loop block will be applied to every model in turn, in an endless loop. Separating the initialization block and running it only once speeds up the animation significantly when the PDB file is large. The loop block should contain only display (rendering) commands.

The boundary between the initialization and loop blocks is marked by a special comment which must begin #$. Additional text following the required characters #$ is permitted (and ignored), as in the default delimiter

#$ Begin animation loop
If the #$ delimiter is omitted, the entire script will be used as a loop block.

Initialization Block Contents

The commands in the initialization block should establish the color scheme and center (if not the default), as well as options such as stereo (if desired). It should not include any display (rendering) commands such as backbone, spacefill, etc., as these will be superceded by the display commands in the loop block.

Orientation and zoom in animations. Upon pressing the [Animate] button, a "view set" command will automatically be inserted in the animation window to establish the current orientation and zoom. (If, on the other hand, you manually insert a "view set" command in the initialization block, it will prevail. Typically, it should be the last command in the initialization block.)

Slabbing in animations. If you do not want your animation to be slabbed, you may skip this paragraph. If you want slab mode to be on in your animation, you need to insert a "slab on" command at the end of your initialization block. If you set a slab plane position other than 50 (the default) before pushing the [Animation] button, this will be set accordingly in the animation with the automatically inserted "view set" command (see above). However, if you also type a "view set" command into your initialization block, you need to specify the slab plane in the "view set" command (which will override any value you might give in the "slab" command). You can generate a "view set" command reflecting the current settings by entering "vs" into the command entry slot.

Loop Block Contents

The loop block should contain only display (rendering) commands. These will utilize the colors established in the initialization block. In order for the loop block to render one model at a time, the display commands must be preceded by select commands that include a model number. Since the model number needs to be changed for each model, it is represented by the symbol "@", for example restrict model=@. In these select or restrict commands, there must be no spaces before or after the equal sign.


The best way to customize a script is to modify the automatically-generated script. However, for purposes of illustration, we can also consider entirely new custom scripts. The simplest possible custom script would have two commands, for example

Try pasting the above script into the box. Since no color scheme is specified in the above script, the [Model+][-] and [All] buttons will leave intact whatever colors exist. These colors could be changed by manually entered commands, or from the QuickViews menus. However, the animation needs colors to be specified. So you could change the above to

Press the [All] button to initialize the color scheme in order to avoid "out of colors" error messages with the [Model+] button. Although the above script will work, it works better using the initialization and loop blocks explained above:

Custom Scripting with One Model Always Shown

When the script in the box is customized, keeping one reference model "always shown" is tricky. Entering a model number in the "Always show" model slot is required but is not sufficient to produce the desired result. The initialization block must take into account some limitations of Chime. The best way to proceed is to choose the radio buttons closest to what you want, set the model number in the "Always show" slot, run the animation, display the automatically-generated initialization block with the Scripts link in the animation window, then copy that and modify it for your customized script.

Similarly, use the loop block as an example from which to contruct your loop block.

The automatically-generated initialization block works around two bugs in Chime. First, if the group color scheme (N->C Rainbow) is desired for all models except the one always show, it cannot be applied in a straightforward manner. Second, the color desired for the always-shown model must be "reserved", else Chime will run out of colors ("unable to allocate shade" error message). Although the strategy described above is the best way to proceed, the bugs and workarounds are further described below for those interested.

Group coloring bug and workaround

This bug arises when the group coloring scheme is applied following any select command which excludes one model, such as any one of these:

Under these circumstances, the group coloring scheme fails to be applied. In order to keep one model a special color while having all other models in group color scheme, it is necessary to 'reserve' that color first, then apply the group coloring scheme to all models, then select and color the special model. Reservation of the color is necessary because otherwise the group color scheme uses all colors in Chime's limited palette, and the additional color can't be generated (error message 'unable to allocate color'). Dots are a good way to reserve a color because they can be colored independently of the atoms, and they can be turned off when no longer needed. To see an example of a script that uses this strategy, view the automatically-generated animation script as described above. Below is also a generic example.