Wednesday, April 28, 2010

Atomistic Small Bearing: dynamics performed in NanoEngineer-1, visualized in Blender

The astute viewer will notice two things first:
1-I still can not frame a shot for shit.
2-The back side of the rotor is missing a hydrogen atom

Well, these are still more or less movies where I am more concerned with getting different things to work than I am with cinematography and such. Maybe next time I'll throw in some long parallel walls to frame the action. Also any long time readers of this site will know that I have had my problems with hydrogen in the past, but, all in all, things have come a long way from the last time I posted anything about the famous small bearing first proposed by K. Eric Drexler back in 94, I believe.

A little about how I did it:

NE1 will save simulations in two ways, either as a binary file (which I can't do much with right now expect turn into gibberish) and a series of POV-Ray files, one for each time step. So you are probably thinking "why not just stitch the povs together, adjust the lighting, camera, materials, whatever and call it a day?" I know POV-Ray is great, and I'm pretty sure it is all Pixar uses, but I'm just a gui type of guy I guess. So I have written a Frankenstein's Monster of a script that will read in a series of povs and create atom trajectory files, one for each atom. Normally it would then just be a matter of using Miron Cuperman's import_ipo_script to connect the atom trajectory files with a PDB model which NE1 exports and Miron has also provided a very fast importer for.

The only problem here is NE1 writes the atoms in a different order in povs and PDBs. It is very important that the right trajectory matches up with the right atom. So I added another section (subroutine?) to my script that will read in the first pov ray file and create a bona fide .xyz chemical format file. I went with the .xyz because it is the simplest format I know of. Then all you have to do is run it through Open Babel to convert it into a PDB file that has the same atom order as the pov files and can be imported into Blender. That's all there is to it.

I fully intend to clean it up, rewrite parts so they're not embarrassing (even for me) but if you can't wait, you can get a copy of my script. The XXX stands for a couple of things. Guess!

No comments: