Saving and Reloading Your Work

Part of the Jmol Training Guide from the CBM

Interactive Molecular Window (click and drag to rotate)
Tutorial Content
+
-
Font Size:

Saving and Reloading Your Work

Part of the Jmol Training Guide
from the MSOE Center for BioMolecular Modeling

Click Here to download this tutorial as a PDF

Introduction

Any time you design something exceptionally cool in Jmol, you should save it! Saving your work allows you to revisit the design later, share the design with a collaborator, and revert back to your saved state if something goes wrong later on.

There are two main ways we suggest you save your progress in Jmol, as a JPEG File and as a Script. Each technique has its own advantages and disadvantages and are described in more detail below.

Note that both of the saving options described below can only be performed on the desktop version of Jmol. The web embedded Jmol shown to the right and the console below will not work for practicing these saving commands.

Saving Your Work as a JPEG File

If you want to create a image of your molecule from Jmol (to use in a poster, for example), you can save a JPEG or a PNG file. To do this, click the "File" menu located on the top left of the Display Window. In the dropdown menu, select "Export" and then "Export Image".

Alternatively, you also save a JPEG or a PNG file by clicking on the small camera icon in the Jmol Toolbar Menu. This will open up the same saving dialog box as exporting an image through the "File" menu.

Any image saved from Jmol functions like any other JPEG on your computer and can be opened without Jmol in programs like Microsoft Word and Powerpoint.

Note that your image will capture exactly how your molecular structure was displayed in the Jmol Display Window on your screen. The larger the size of your display window on the screen, the higher the resolution of the image that is exported.

The Secrete Side of Jmol JPEG Files

One of the neatest tricks in Jmol is the secrete reloading power of a saved Jmol JPEG file. If you have saved a JPEG from Jmol, you can drag the JPEG into an open Jmol display window (the same way you can open a PDB file by dragging it into the display window). This will bring your saved work back up in Jmol. the structure will be fully interactive and is ready to begin editing again!

Note that the JPEG file has to be saved in the same folder as the .pdb file that accompanies the image.

Be aware that if you edit the JPEG file in an image editing program (such as Microsoft Paint or Adobe Photoshop), you may loose the ability to reload your saved work in Jmol using the JPEG. The way Jmol uses JPEG files to reload your molecular design is by storing the Jmol commands you used in a special Comments section of the JPEG file. This comments section is often overwritten when the JPEG is opened and resaved using a different piece of software.

Similarly, when sharing your JPEG file by email, make sure to attach the JPEG file, rather than inserting it "inline" into the email text and content. Inserting a JPEG into an email's text often overwrites the comments section of the JPEG, removing a record of your saved design.

Saving Your Work as a Script File

Saving a JPEG of your model design is useful, but it won't give you a record of the commands you used to produce the design. Script Files allow you to create an exact record of the commands you entered to produce your model design. This information will be helpful if you decide to create an Jmol Tutorial or Proteopedia Page to accompany a model.

After you have completed your model design, click the "History" button on the Jmol Console. This will generate a list of all the commands you entered, without any of the Jmol feedback messages. Copy and paste this history into a word processor or text editor such as Microsoft Word or Notepad.

  • For PC Users: Select the script and use CtrlC to copy and CtrlV to paste (right-clicking to copy and paste in Jmol will not work).
  • For Mac Users: Select the script, and drag and drop into a word processor.

Be sure to include the following information in your text document before saving:

  • Date
  • .pdb file name
  • Name of file(s) containing your model design – and the path to the files (folder name, etc.)
  • Information about the features that are displayed in this particular model

Editing a Script

There are some basic steps you can run through to "clean up" your script and make it easier for you (and others) to interpret later on.

  • Remove the first three lines or so of your script, starting with "zap", "load file", etc.
  • Remove any typos that occurred while you were designing your model so that only meaningful commands are recorded in the script.
  • Remove any "blind alleys" that you took in your model design. . . and later decided to remove. For example, if you changed your backbone color multiple times while trying to decide what will look best, you no longer need the previous "color backbone" commands for the colors you didn't like. You'll only need the final "color backbone" command that represents the actual color of your model.

Annotating a Script

Any line that begins with the symbol # is ignored by Jmol, so you can add comments to your script. It is often a good idea to add comments to indicate what features you are depicting in each of the blocks of commands (we often call these blocks of related Jmol commands "cassettes").

Below is a sample script before and after editing. Click Here to view the graphic below as a PDF document so it can be enlarged and studied in detail.

Opening and Testing a Script

After annotating your script, you should always run the script in Jmol to make sure there aren't any errors and that the final molecular display is correct. To run a script file:

  • Open Jmol
  • Drag and drop your .pdb file into the Jmol Display Window
  • In the Jmol Console, click "Editor"
  • In the Editor Window that pops up, click "Script" then click "Clear", which will empty the scripting window
  • Copy and paste your script into the editor window
  • Make sure there are no extra lines or spaces at the end of the script. These will prevent the script from executing properly
  • Click "Run"

Making Changes to Your Script

You can make changes to your script in the Script Editor Window and rerun the script to view the changes.

If you make a change to your script in the Script Editor Window, you should test out the change by running the script on a "fresh" .pdb file. To do this, either reload the .pdb file in Jmol, or simply click "Undo" on the Jmol Console to revert your model to its original form. This will let you quickly see effect of the change you made in your script.

Be sure you save your final revised script into a text editor or word processor when you are finished making your edits.

Finding and Fixing Errors in a Script

If the script doesn't execute, look in the Console for error messages. The console should direct to you the location of your error, where you an correct the script as needed.

If you can't find the error, you can click on "Step" instead of "Run" to execute the script line by line. You will need to click the step button to execute each individual line in your script.

Alternately, you can quickly narrow your search by removing the last half of the script, then running the first half. If the first part runs without problems, you can add additional chunks of script and run again. If the first part doesn't work, break it down into smaller chunks to isolate the problem.

Naming Conventions

As you are exploring your molecule and developing your molecular story, you will probably go through several iterations of your model design. We recommend that you save your designs early and often. We suggest that you save each design as a new file, and that you number the designs consecutively.

It is not a good idea to save over your earlier designs! Once you are satisfied with your final designs, you may wish to delete the unnecessary files, but keep iterative designs while creating your molecular design.

Table of Contents

  1. Getting Startedi n Jmol
  2. Finding Protein and Molecular Structures
  3. Changing Colors and Display Formats
  4. Saving and Reloading Your Work
  5. The Select Command and Boolean Operators
  6. Adding Sidechains to Your Structure
  7. Bonds and Structural Supports
  8. Working with Nucleic Acids