This science cake contains theobromine
Theobromine is found in chocolate, and is chemically related to caffeine. The difference is just one methyl group.
Obviously, the cake had to be a chocolate cake. I used this recipe for vegan chocolate cake, but I used a (non-vegan) icing to hold the different parts together.
For the theobromine molecule, I braved the M&M store on Leicester Square, where you can pick and mix the exact M&M colours you need. In my case: black for carbon atoms, white for hydrogen atoms, red for oxygen atoms, and blue for nitrogen atoms.
I originally planned to make this cake for the Comic Relief bake sale, so I also bought a LOT of red M&Ms in addition to the ones I needed for the molecular structure. My actual baking day ended up a few weeks later, but I still wanted to use my massive bag of red M&Ms, so I made a piñata cake. The idea is that when you cut open the cake, M&Ms roll out.
The cake was a bit less bouncy than would have been ideal for a pinata cake, and the icing held many of the M&Ms inside, but the effect was still somewhat in place. See the video for the entire cake making and cake slicing process.