Medical and scientific animations frequently require the display of molecular models from PDB (Protein Data Bank) files. Until we get access to ePMV the options for Lightwave users are Sean Moyer’s PDB reader (which, unfortunately, inverts models on their Z axis), or an external molecular viewing software.

My viewer of choice is PyMOL. PyMOL is a molecular visualization viewer, built on open-source software. There is a subscription version, which includes support and some extra features, but for just exporting models for use in Lightwave, the pre-compiled open source version (described here) will work just fine. There are thousands (millions?) of known structures available in the PDB Database, and figuring out which one to use, or which parts of it to use is a dark art unto itself. For the purpose of this tutorial, we will be making hemoglobin from the file:

4hhb.pdb.

Here’s mine on Sketchfab.

 

Ok, let’s get started. Open PyMOL (if you need to install PyMOL, follow the instructions, here). Two windows will open: a viewer and a text window, with a bunch of menus and buttons.

Art of the Cell - Pymol Tutorial

In the command line at the bottom of the text window, type the following command

fetch 4hhb

PyMOL will fetch the pdb file and display a line version of the molecule. Cool!

Art of the Cell - Pymol Tutorial

now, type the command

split_chains

In the list on the right side of the viewer, you will see four new entries, corresponding to the separate parts of this structure. If you don’t want separate parts, you can skip this step, but split_chains is a very useful command, especially when you get to animating and surfacing.

Art of the Cell - Pymol Tutorial

You can toggle the pieces on and off in the list, and each of the letters accesses a drop-down menu of choices. The letters stand for Actions, Show, Hide, Label, and Color. You can have a play with them later, for now onward!

Click the H for the “all” entry at the top of the list and choose Hide: everything. The molecule will disappear. Surprise. Now click the S and choose Show: surface.

Art of the Cell - Pymol Tutorial

And that’s what it looks like if you run a pocketful of skittles through the dryer. Seriously, the default color scheme is hard to look at. If you want to save your eyes, click the C button for “all” and choose something else. a nice gray perhaps? Aaahhh, that’s better.

Art of the Cell - Pymol Tutorial

It doesn’t really matter what color you choose, since the model will be surfaced in Lightwave (or whatever other collection of 3D code you prefer to bang your head against.)

If the model in the viewer is what you want, then you are ready to export, but let me show you a few things first. Under the “Display” menu in the text field, there is a sub-menu for “Quality”. Try each of the settings and see what it looks like. “Maximum quality” looks nice, but is a super-dense mesh. The default is “reasonable quality” and is just what it says on the tin.

Art of the Cell - Pymol Tutorial

Another way to change the model’s appearance is to change the “Solvent Radius”

type:

set solvent_radius, .5

in the text field. This changes the size of the balls which represent the atoms of the molecule, and is kind of a “season to taste” thing.

Art of the Cell - Pymol Tutorial

Now reset the solvent radius to 1 or so (the default is 1.4, I think).

Finally, to save your model as an.obj, type:

save Hemoglobin.obj

and PyMOL will export an obj of the model to the directory where the pdb is stored (in this case, since we used the fetch command, it’s in the program directory where PyMOL is installed) You can add a path name to the front of the file name if you like,

such as:

save C:\Users\John\Desktop\Hemoglobin.obj

but I never do. 🙂

Now you can open the .OBJ in Modeler. There are all sorts of things you can do now, but you should always merge points (it will be all unwelded) and change the surface to get rid of that weird shiny .obj surface that it comes in with. Depending on how the model will be used, it might be a good idea to reduce its polygons. (this model came in at 113,000 polys!) This can be as simple as running Qemloss, or as complicated as bringing it into a sculpting program and retopologizing, but I leave that to you.

And that’s a basic PyMOL to Lightwave workflow. You can find lots more information on PyMOLWiki, and there are a few more tricks and tips, for more advanced uses that I may address in the future, if there is interest. So if you have any questions or comments, please let me know. Or share you own tips in the comments.

Cheers!