Organometallic Odyssey
  • Home
  • Categories
  • Tags
  • Archives

3D Models in PDFs

I've had this idea for quite some time now: I would like to be able to incorporate interactive 3D figures of crystallographic models in my PDFs. It started when I was reading about Asymptote, a vector graphics package with the ability to embed 3D models in PDFs. I set out to write a program/script to turn a CIF into Asymptote code. Fortunately, I've since run across some other people with similar ambitions, so I'm using their experience as guidance, and I will be documenting my ideas here.

File Formats

CIF

The standard format for small-molecule crystallographic models, this is the universal starting point

mmCIF

A standard format for macromolecular crystallographic models. This is a reasonable intermediate, because there appear to be a swath of tools available to convert this into other useful formats.

PDB

Another, very common, format for macromolecular models. Can be as simple as a list of XYZ coordinates, or can include more details, such as unit cell dimensions and thermal displacement parameters. Very human-readable, simple text based system.

VRML / X3D

The original web standard for 3D content. Has fallen somewhat by the wayside on the web, but has become a catch-all file format for a 3D programs.

The proposed replacement for VRML, X3D is XML-based.

X3D/VRML Resources

U3D

U3D is also XML-based, and has been around longer. I don't know why it's not the "new VRML" format. This is the format Adobe PDF readers expect to see for embedded 3D objects. (U3D File Format Specification)

PDF

Of course, this is the standard document exchange format. This is the target system which we would like to embed out graphics in.

Programs

PyMOL

jMOL

Mercury

Mercury is capable of converting CIF files to PDB files, while retaining the data pertinent to an accurate 3D model (a, b, c, α, β, γ, Uij, etc…)!

Xj3D

Asymptote

LaTeX

Adobe Reader

sf-convert

maxit

MeshLab

Meshlab can convert VRML or X3D to U3D, which is what Adobe uses for PDFs.

DRAWxtl

DRAWxtl can import a CIF and export a VRML file with all the thermal ellipsoids intact! It's a bit clunky to use, though.

Diamond

Diamond can also import CIFs and export VRML with all thermal ellipsoids intact! It's commercial software, but available in a demo form that does not restrict your ability to export VRML. Probably the best COTS solution.

X3D-Edit

X3D-Edit is usable as a VRML/X3D conversion tool, as well as a validator. It's a program written by the man who literally wrote the book on X3D.

Workflows

PyMOL → MeshLab → movie15

This doesn't work because PyMOL, for whatever reason, will not save the ellipsoids in the exported VRML document (or in POV-Ray documents, either). Also, MeshLab doesn't like the VRML format that PyMOL makes, anyway. Xj3D, on the other hand, has no issues with opening/converting these files. However, even if you use Xj3D to convert from VRML to X3D, MeshLab will still complain.

Convert from CIF to VRML Open the CIF in PyMOL show ellipsoids save filename.wrl Convert from VRML to U3D Open the VRML 2 (.wrl) document in MeshLab File → Save As… → U3D Embed the U3D document using the movie15 package (concise instructions)

VTK → MeshLab → movie15

Nearly identical to the above, but find an app that uses VTK to display a CIF.

Mercury → POV-Ray → Custom Script

This was one of my original ideas: use Mercury's ability to export POV-Ray scenes to generate an input file that can be readily translated into Asymptote code. Right now, this isn't looking so bad…

CIF → PDB → VRML → U3D

Use Mercury to convert from CIF to PDB. Make a (Python?) script to turn that into an VRML model. Then MeshLab can convert the VRML to U3D. I'm guessing that VRML will likely be easier to implement, but X3D or even U3D could probably be implemented as well. This appears to be the route of choice.

Comments
comments powered by Disqus

Published

Dec 1, 2001

Category

crystallography

Tags

  • 3d 1
  • cif 1
  • crystallography 4
  • embed 1
  • pdf 1
  • Powered by Pelican. Theme: Elegant by Talha Mansoor