Workflow for rapid prototyping of molecular data
Written by Paul Bourke
February 2012, Updated October 2013
The following describes one of possibly many pipelines for taking PDB models and
producing physical representations using Rapid Prototyping (RP). In what follows
various packages will be used to create representations, generally of PDB files.
The RP system will be based upon the online service offered by Shapeways
(see appendix), but the
printable models created will be applicable to any RP facility based upon the two
main machines in this area, namely the ZCORP and ObJet. Note that as with any documentation
of this type it can become out of date as time goes on, new releases of the software etc.
This is especially so since some of the work flows described here result from bugs
or other inadequacies in the chemistry software or the Shapeways software.
The software used here and versions numbers are as follows:
- VMD, Mac version 1.9.1
- MacPyMol, version 188.8.131.52
- MeshLab, version 1.3.2 64 bit
- Mac OSX, version 10.8.2
The requirements for any model destined for RP processing are
- It must be "watertight", otherwise referred to as manifold.
- It must be the correct dimensions.
Many of the file formats (STL, x3D, wrl ....) do not explicitly define units, as
such RP software has some license in what units to apply.
- The mesh approximation of the shape is ideally not evident in the final 3D print.
- In the case of colour prints, the intention here, there is a limited set of
file formats that support colour and are supported by RP suppliers.
The examples provided here will use the following structure:
VMD - sphere models
- Render as VDW
Adjust the size of the spheres so it will be structurally sound and connected, nothing that smaller
spheres will result in less material and hence lower printing costs.
Turn axes off since they will be exported as geometry however
they can also be deleted later in MeshLab.
Render to OBJ file. This will produce two files, a .obj file and a .mtl file.
For example: vmdspheres.zip.
VMD seems to sometimes create an incorrect reference to the .mtl file, this will
result in no colour when importing into Meshlab (or other obj file readers).
This can be fixed by editing the .obj
file and correcting the name of the .mtl file in the header.
- Import the .obj file into Meshlab.
The .obj models from VMD are very inefficient, each face of each sphere do not share vertices.
There is a bug in Meshlab whereby if the duplicate vertices are removed (normally a good thing)
then the resulting wrl file is corrupt.
- Scale to unit bounding box, found in the "normals, curvatures and orientation" menu.
Scale to known size, on import Shapeways will give the option to use units of mm.
- Unfortunately the sphere resolution option in MatLab is not reflected in the exported geometry.
If the spheres are considered too course refine the mesh using midpoint
subdivision surfaces, see the "remeshing, simplification and reconstruction" menu.
- Apply a Laplacian smooth, this can be found in the "smoothing pairing and deformation" menu.
- Export as wrl and optionally zip the result for faster upload.
- Upload wrl file to Shapeways (see appendix).
PyMol sphere models
- Turn off all representations except spheres
- In the prompt region type "set sphere_scale,0.7", or a size that retains connectivity
but minimised printed volume.
- Save image as PovRay, file menu. PyMol does allow a model to be saved as wrl but
there is no straightforward way to scale for the RP process.
Note that in the prompt region it is also possible to save a PovRay model file by
typing "ray renderer=1".
The PovRay format was chosen since it is a relatively easy format to parse in
order to extract the spheres, their radius and colour, and then scale and save
as wrl for upload to Shapeways (see appendix).
Usage: pymol2wrl [options] povfilename
-s n scale factor
An example of the povray file is:
example.pov and an example of the output wrl file is
example.wrl. Note that spheres can be represented in wrl files
in multiple ways. One, and is used here is to use the sphere primitive. The risk
with that is that you are relying on the RP software to tessellate the sphere suitably.
The alternative is to tessellate the sphere oneself at a higher resolution,
see reference to WRLSphere3() in the code above.
At the time of writing Shapeways allows one to upload wrl files and select
units of millimeters, inches, or meters.
Examples of final printed models.
PyMol surface models
Rapid prototyping of PyMol surface models is relatively straight forward, the
following outlines the steps used to create models accepted by Shapeways
(see appendix). Software
used is just PyMol and MeshLab.
Turn off all representations other than the surface.
Set the surface resolution, the default is rather low. This is achieved with
the following command "set surface_quality, 1". Higher numbers can be used but
note ShapeWays has (at the time of writing) a 64MB file size limit or 1 million
faces, which ever comes first.
Save the file to a wrl file, as "save something.wrl".
Open the wrl file as saved from PyMol.
Check the faces count.
In the Normals, Curvature, and Orientations menus scale the model to the desired
size. Since there is no known size, first scale to a unit cube, then scale to
the desired size. Note that ShapeWays expects mm for the dimensionless file
format to be used here.
Export to as x3d, choose vertex normals rather than face normals.
Unfortunately the model testing at Shapeways is overly conservative. Models that are perfectly
acceptable for printing on the ZCorp printer are regularly rejected. While people creating
models manually in a 3D package can normally correct such problems, there is not always the
opportunity to fix models created from scientific data. At the time of writing the author is
preferring to use local RP companies instead of Shapeways.