at the time einstein , who had moved to berlin four years earlier to take a lucrative appointment to the prussian academy of sciences and become director of the newly formed kaiser wilhelm institute of physics , was 38 and in the process of divorcing mileva , presumably so that he could marry his cousin elsa .