Simulating what polymer chains look like in solution
Why?
If asked what I enjoyed most about studying materials science, I'd say it is the opportunity to gather in-depth knowledge and understanding of natural laws and processes that are of relevance in the function and design of materials. And since most stuff in this world is made of some kind of material, it really offers an entirely new way to view the world.
If asked what I'd rather do less, it's memorizing facts that are easily forgotten after the exam is passed, and are better looked up when actually needed. I'm not an encyclopedia. Unfortunately, asking for facts is the easiest way to create an exam. But such an exam does not test understanding, it tests the ability and willingness to binge-learn. And it is very much a reality at uni.
So how do you stay motivated, when faced with hundreds of pages of terribly organized, loosely thrown together material in a script, and you know that your passing grade will depend on your knowledge of trivial names for chemical compounds, your speed in drawing molecular structures, and your luck that the professor chooses to ask for just those facts that you managed to memorize in reasonable time and with reasonable effort? Because, face it: Studying for such exams is only remotely related to studying for life or career.
My answer was always: Take the mix of undigested information served by an overworked or uninterested professor and turn it into something more useful. I kept myself at it by believing I could make the journey a tad easier for those who will come after me. Multiple script summaries/corrections/improvements I shared with my peers prove the point. By believing my work had some sort of meaning, I could stay at it. By my desire to make something good of it, I tried to understand it fully. By doing that I invested a lot of time, understood many things, but usually still did not remember the superficial details asked for in many exams. Of course, there are exceptions and I know a few professors who put an immense amount of time into their lectures, and I'm very grateful they exist!
How?
But to the point now: Last year, during the first "Corona semester", I took the lecture "Structure and properties of functional polymers". Part of it deals with understanding how polymers behave in solution. Polymers that go into solution are generally such that consist of long chains with limited side chains, and do not form interconnected networks. Because if you add a solvent to a network, you just get a gel.
There are three important mathematical models for such extended linear chains in solution, starting at the very simple and adding complexity in the others.
The simplest one is entirely random. You have a bond from one link in the chain to the next, and then another, and another, the direction of which is entirely up to chance. This is easy to treat statistically, and many material's properties ultimately depend on statistics, but it's not very physical, since the chain is effectively allowed to grow back on itself. The next atom does not know about the previous and could thus end up at exactly the same point in space. This model is known as the "freely jointed chain".
In the next model "back-folding" is no longer possible, since the angle between links in the chain is fixed. The bonds are still free to rotate around the axis of the previous bond, but they're guaranteed to point in a different direction. This is the "freely rotating chain".
Finally, the chemist has to acknowledge that atoms attached to the backbone of the chain are interacting, usually repelling each other. This makes certain rotational angles energetically more favorable than others, so they will be seen more often. This the the "chain with restricted rotation".
So we got all these formulas describing the three models. But that was pretty much it. You do not exactly get an intuitive understanding of molecular chains when you look at a complex mathematical formula. And the spaghetti analogy given to us also didn't help much. I wanted to know what the formulas meant, and to see what it looks like, the thing they describe.
Now, I'm studying materials, the "hardware" of our world, but I also have a knack for coding, since I'm constantly learning more about the "software" humanity has created at my leisure. And then there is the area where the two worlds meet, and I feel naturally at home: Computer simulation. I had created computational lecture material before, as part of my Research Assistant position at the chair of Materials Design of the University of Stuttgart, so I decided that I really wanted to know, even if it meant that I'd have to get my hands dirty.
Now, you can't exactly just give those formulas to the computer and tell it to make something of it. You have to feed it to him in bits and pieces. Pun intended. So I did that, which created a few interesting statistical challenges, and the final question of how to present the findings. These models are 3D, and it turns out that simply plotting the 2D projection is not very useful, since hard to read. The solution I chose involved Python, tasked with the creation of the data, which is the atomic positions in the chain, gnuplot, tasked with making the data into figures due to a specific shortcoming of Python's matplotlib, and ffmpeg, a command line video editor, with which I combined several figures into beautiful video animations showcasing the 3D structure of polymers in solution. And here's what they look like:
Freely jointed chain: 500 links
Freely jointed chain: 50 000 links
Freely rotating chain: 500 links
Freely rotating chain: 50 000 links
Chain with restricted rotation: 500 links
Chain with restricted rotation: 50 000 links
Where to learn more?
If you want to learn more about how I did it, you can download the Jupyter Notebook and other codes necessary to create the videos from here. If you don't want to download random computer code from the Internet, you can still see the notebook, without the ability to run it, here.