Writing a PhD Thesis

In September 2017 I have finished my Master's degree in Physics. I was offered a PhD position by my supervisor and gratefully accepted the opportunity. During the master thesis I started to work with lattice simulations, supercomputer programming and was getting into it. Although I already did not want to persue a full career in science, I still wanted to do a bit more research in physics before leaving for the industry.

The thing is that in Germany usually only 25 % of the employees in institutes have permanent positions. And these are usually people who do administration part time. These people are full time professors, administrators of machine shops, computer clusters or something else. The majority of positions are temporary contracts. The rationale seems to be that research benefits from the exchange of ideas, and if people move around the instituions, knowledge is spread. This completely ignores the fact that these are people, eventually wanting to start a familiy and the like. One usually does not get a consecutive contract at the same institution and have to move, often somewhere within the EU. The real chance for a permanent position would be to have it mixed with something permanent, we have IT administrators that are part-time administrators and part-time researchers/teachers. But then it is not really a career in research, it is merely something in academia. All these things set my long-term route, but I did not want to leave research at that moment. So I took the opportunity to do research for another three years.

At the beginning of a PhD the topic is not clear cut. My advisor had a few ideas, and I mostly started working with my valued PhD student coworker Markus to work on his project. There I helped to refactor a C++ code which did tensor contractions. Over the time I learned more of the code, had more and more ideas on improving it. Together we worked on it a lot, it was a really great time. Also I helped to improve the analysis that he needed for his data. Over time it became our analysis, I wrote most of it in the early days. He explained some of the mathematical theory behind it, I implemented a bunch of statistical transformations. On some days we sat there until very late to make some plots really readable, pretty and informative. As the project came to a conclusion, he finished up his dissertation and eventually handed it in. I was super happy for him to finish, and also sad to see him go and move to a different city.

The beginning

One thing that I saw with the three PhD students that started years before I did was the choice of programming language. The professor has his analysis library written in R, and that was rather feature complete. But the students did not like R and rather wanted to use Python. I can fully understand this feeling, Python is a nicer language than R is. But there was already so much tested code in R that they effectively set themselves back 1 or 1.5 years each. The result was a partially functioning code, which was only used by two or three of the PhD students. I had seen this pattern during my master thesis and decided that learning R cannot be that hard. In the end I learned R in a few weeks, started to mock other people's R code for not being idiomatic after a couple of months. Everyone who came after me is now asked to also learn R and use the code, it is now the official code of the whole group. In 2020 we even uploaded it to CRAN to make it usable for everyone easily!

Overlapping with Markus's analysis, my advisor has sensed the opportunity to compute three pion scattering on the lattice, there weren't any determinations with multiple references frames available at the time. So I got tasked to write a code which does the group-theoretical projection. Markus has taught me how the mathematics work, so I just had to implement it. Looking for the right tools took a few days, then I settled on Wolfram Mathematica for the task. I haven't used it before properly, so I took two days to learn the Wolfram Language and developed away. It worked really well, and I got the results that Markus got much faster as I could make use of all his knowledge. Unfortunately I could not ammend his code as it was too tailored for his specific task. I set out to make the code do all the mathematical steps. I know that I sometimes make mistakes and don't want to redo all the steps afterwards when I step a mistake. This was great, as everything was pretty consistent. It took a bit more time to get everything done in Mathematica compared to simply doing the simple steps by hand. It turned out that in the end I had like 200,000 terms in my expression. I was glad that I let the computer do it all the way.

The projection and contraction code were tested on multiple levels. This way I was confident in my intermediate results. Some people have spent months trying to track down some obscure error somewhere in their software stack. I did not want to do that, and rather spend a little more time to verify each level while I was working on it. This has saved me a bunch of time in retrospect.

The intermediate period

One of the freedoms at the university was that I could work with my personal laptop. There were workstations available, but nobody was really taking care of them. They had some dated Debian installed on them, and I wanted to use my Fedora with a modern C++ compiler. So I bought a second docking station and set up my desk in the office the same as at home. I could just take the laptop out of one dock, change places and then dock in again. This was very practical, but it has one crucial disadvantage: One does not have any separation between work and home. I could work and play both at home and the office. Often I would continue to work at home and until late in the evening. Also I would do personal stuff in the office and get nothing done there.

I tend to err on the side of doing more work than needed. Some people procrastinate and then scramble to find time at the end. As time now and later is the same, a week full work at the beginning or the end does not really matter. So I started off well in the beginning and slowly eased as I saw that progress was going good. At some point I noted the times I put into work such that I could better allow myself to take the evening off. This is a pattern that one needs to observe, and act accordingly. During the last year of my thesis I noted the time and just stopped working after I reached around 40 hours a week. And then it got even better. I realized that I have a very productive four hours in the morning. I would do these with lots of concentration and then relax in the afternoon, letting my thoughts roam freely and sort themselves.

After almost exactly two years I hit a dip in my motivation. That seems to be a common theme among PhD students, as I learned later. I looked at the things that I still had to do, and also saw how long the project together with Markus took more time than we have anticipated. I thought that doing a second project would take another two years. Most PhD students that I have seen in our group took four years to finish. And they would transition into the industry and sometimes not even have handed in their thesis then. I feared that I would be stuck at the university for another two years with unclear prospects. I thought about quitting, moving to the industry, having a 9-to-5 job without having to constantly think about getting my thesis done before the contract runs out.

I have talked to my family, to my friends. They have encouraged me to do what I feel would be right. They said that nobody requires a PhD to be worth something, I already had a master's degree and that was already plenty qualification. Other friends in other departments have told me that they are now in their sixth year of their PhD studies and I thought that I should quit before I end up as an eternal and unpaid PhD student. And then I also talked to my advisor and the postdocs in our group. They told me that they can understand this phase. And if I wanted to quit, it would of course be possible, but they would be sad to see me go. My advisor told me that I could do it in three years. This gave me more confidence. And we set out a plan of a minimal thesis. Looking at all the things that I thought I had to do and the things that he set out as a base line, I realized that it was doable within a year. Even conservatively, it should be possible. So I did not quit, took this iternary and continued to work. And in the end I passed the baseline around six months before the end, and surpassed it significantly with three months before the end. In retrospect I don't even know why I did not ask my advisor about this first, perhaps I needed to sort my emotions with the help of family and friends first.

Writing up

Writing the thesis was surprisingly fast. My writing style is that I let some topic float in my head and toss it around on occasion, mostly subconcious. And then some day I have the urge to write it all down. I would create a new section in my thesis, and write five pages about some particular thing. A few days later something else was done in my head and I could write it down. This way I was usually excited about writing, and I just had plenty to write about. Within a few weeks I produced like 50 pages of thesis. And in the coming weeks it was already at 100 pages.

As part of the COVID pandemic, I have worked from home the last six months of my program. It was not that difficult from a technical side, as I have the exact same screen and docking station setup at home as I have at the office. The major difference was lunch. We usually went to the campus canteen at noon, had a lunch and talked a lot, socialized. This was all gone, and I had to cook myself every single day. The lack of a routine was hard at first. After a while I got used to it, and towards the end I had a really good routine of working the fresh morning hours and just quitting when I felt my concentration exhausted.

If one has a job like working in a supermarket, on an assembly line or something like that, one cannot take any work home. Also I imagine that there are opportunities to get promotions, but one does not have to burn oneself out to advance. With a PhD program, it is really bizarre. My work contract would be just part-time. I was supposed to work on the thesis in the other half, my free time. But what exactly do I do in the work group? I work on projects, and one of them became my main thesis project. So there is on way to really set this apart. And the problem was that I would not be guaranteed the PhD title at the end of the three years. However, I only got the money for three years. Basically I either manage to finish in time, or I fall off the employment cliff and would have to either finish the thesis in parallel to a full time job (unrealistic) or finish it while living off savings (unpleasant). This made me to work really hard, and almost always think about the thesis. As it was my first PhD thesis, I did not know how much work was needed. People around me had issues finishing within three years, some were even at it for like seven years. Without a reference, I just worked a lot. Sometimes I had the feeling of self-exploitation, and that is not a good sign. I am not sure how to fix this without making the PhD a fixed outcome after the three years. Perhaps it should be with a master thesis where the time is limited and one either has to hand it in (and accept the grade) or just quit altogether. But not this endless lingering and potentially endless projects that delay and derail everything.

Although my work contract said that I did not have to do teaching, I still had to do teaching. I decided that although it was fun, it was time that I would not have for my thesis. So I took the classes which were much less work then the others. In the end I did the computer physics classes like three times each. Over time I just got more efficient in reviewing the homework of the students. I guess I did not learn as much as other students who taught along different lectures every semester, but it wasn't really a priority for me. A little into the PhD I was asked to take care of the computers in the theory department, instead of teaching. I accepted this job, and it turned out to be even less work than teaching. It was effort to set it up, but once it was automated, it was really easy. The downside was that I needed to fix things at the worst times, and people would come to my office with their computer problems, asking for a fix. Perhaps I would do it again, perhaps I would choose teaching instead.

The PhD defense needs to be done with four lecturers. In my case it was surprisingly easy to find the other three. I just asked my second advisor for the master thesis, he quickly agreed. And I pitched my thesis to two other professors and got a confirmation on the same day. I would have thought that this was some lengthy process, yet it was done so very quickly.

In the end I managed to turn in my dissertation some six weeks before the contract ran out. It was rather relaxed, and at the time I did not feel like anything major had happened. I just did not know what to do right after, as “working on my thesis” wasn't applicable any more. It was a really strange feeling, and over the weeks I finally got the sense of having it done.