Science · Code · Curiosity
3D molecules
Generating SVGs of molecules that can be rotated in 3D space.
Introduction
When I was going through a phase of experimenting with 3D graphics, I got bored of building shapes from planes and cubes, and wonder what interesting shapes I could draw without having to be good a drawing. I eventually struck on the idea of molecules. During my biochemistry degree I'd spent some time looking at 3D models of proteins and had built physical molecules of atoms to better understand their chemistry.
Atomic data
I knew I could find the 3D coordinates for atoms at www.rcsb.org, so I wouldn't need to figure out any coordinates myself. The format is relatively easy to understand and I wrote a program (which I have since lost) to parse the data into a format I could use. For each molecule I have a list of atom type and coordinate, then a list of bonds, which are pair of atom indices.
The first version I created was on Khan Academy (12 years ago now!). I added more and more molecules before finally making a program where you could select from a whole library of molecules.
Leave a comment
Comments are moderated and will appear after approval.