We've come a long way in 13 years ...
By joe
- 3 minutes read - 607 wordsHave a look at today’s Google home page, and you see the 25th anniversary of buckyballs, aka fullerene, which are particular structures made out of carbon. These fullerenes are very much related to graphite (pencil “lead”), and have some very interesting physics and chemistry of their own. They were discovered when I was in my Sophmore/Junior years as an undergraduate. Not feeling old. Nosiree. This isn’t what the post is about, and yes, there is a huge connection to HPC. Notice that on the Google home page, you can interact with the buckyball. Well, rotate it anyway. No special tools required. In the late 90’s I worked for SGI. During that time I got to play with lots of chemistry codes, and I wanted a simple web based tool to enable a 3D viewer for the molecules. So I used VRML and associated viewers. I wrote a code that took an arbitrary molecule format, and converted it into a VRML representation. Even added an axes set in the middle. Then I added in bonds using a nearest neighbor calculation and some heuristics. For large molecules, the nearest neighbor calculation, done in Perl at the time was too slow, so I rewrote that part in C to speed it up.
All of this was fronted by a CGI based web “service” I guess you could call it that, and I called it genVRML. Yeah, I know. Crappy name. Such is life. I may even have the code for this somewhere. 13 years is a long time, and bits do rot (entropy rules, whether we like it or not). It generated output that looked like this:
#VRML V1.0 ascii
...
DEF Title Info {
string " using xyz2vrml by J. Landman"
}
#
# Species=C,Name=
#
TransformSeparator {
Material {
diffuseColor 0.43921568627451 0.501960784313725 0.564705882352941
}
#
# This TransformSeparator contains atoms of the following atom numbers
# atomnum=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60.
#
#
Translation {
translation 1.2265 -3.94384445236367e-17 3.3145
# atom index = 1
}
Sphere {
radius 0.2695
}
Translation {
translation -0.8475 1.1664 0
# atom index = 2
}
Sphere {
radius 0.2695
}
… and generated output like this:
[
](http://scalability.org/images/bucky-VRML.png)
The VRML source for this is here. If you have a VRML or an Inventor viewer, this will work. As you can see, the format of the file is strange, it gives vertexes, and defines what you want to put at them. Bonds are rods, centered midway along the bond. Why am I bringing this up? Because Google did something … interesting. We needed lots of processing power to do these conversions (nearest neighbor calculation specifically), though I’d argue that somewhat less brute force-ish algorithms could have easily been used. What google did, and I have saved a copy of their home page here (note: we consider this a fair use, non-infringement of copyright, to show what they did … we’d be just as happy if they hosted this page for posterity and we could link to it) Looking at their source code, they encoded the verticies, and the bond pairs in javascript functions. Then they created a 3D area, and drew the system right on it. Without any additional plugins. The molecule spins, it follows your mouse. Its very cool. Note to Google(rs) … please let me know (posting here or private email to joe@scalability.org) where the documentation for these functions are. I’d love to do a nice “native” web service molecule converter (and maybe even back end it with hooks into some popular computing packages). We’ve come a long way in 13 years, and darn it, if they don’t have a really cool thing going!