Callum Moseley

Organic Chemistry Simulator

3D web-based alkane building and naming

Introduction

When learning organic chemistry in school I thought that it was super cool how you can build all these crazy molecules. I thought it would be fun to visualize these molecules. I also liked how formulaic and well-defined the nomenclature was, so I wanted to see if I could implement a naming function.

The simulator is available here.

Information

I wrote the simulator using Three.js. It's a really nice library that makes doing good-looking 3D WebGL super easy. I had messed around with Three.js for small demo projects before, so this was a cool project to get more experience working with it.

The molecules form their shape using some simple physics. Atoms that are not bonded repel, atoms that are bonded try to reach a specific distance apart. This naturally causes the molecules to spread out in long zig-zag chains. They also repel from the bounding box but this doesn't seem to work so well.

Limitations

Right now the simulator only supports simple alkanes: it is not possible to add higher order bonds, functional groups, or cycles. This was mainly done just to keep the project (and the naming in particular) less complicated. As well, molecules with very large structures and many nested branches will probably not be named properly.