The life hygiene issues of exercise, sunshine, good sleep, social support are all helpful in getting stuff done.
Beyond that, don’t rely exclusively on your working memory for keeping track of all of the things you need to do. You are already taxing that with learning, and offloading everything you can to external aids is helpful (todo lists, experimental journals, daily 3 page mind-dump journaling). A regular review cycle of what you have written can give you a sense of accomplishment, which can be lacking in multi-year projects with few intermediate wins. Count volume of output as a goal, and use beeminder or something similar to remind you to track it, and show you what you have accomplished (pages written, commits made, hours worked...).
You may want to ask Yvain for assistance.